Dialog em resource com mingw

Projeto [x]Harbour - Compilador de código aberto compatível com o Clipper.

Moderador: Moderadores

Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

Dialog em resource com mingw

Mensagem por JoséQuintas »

Achei algo
It's used when you don't need to assign a specific ID to a control because you don't ever want to refer to it programmatically; most often, a static label that never changes and the user doesn't interact with.

There is no STATIC TEXT control. There is a STATIC control which can display text or images. As Jonathan says, when you don't need to interact with the control at runtime, don't need to receive notifications, the ID is not important. Hence the convention is that -1 is assigned to any controls where runtime interaction is not needed.

It is declared in WinRes.h. A pretty obscure SDK header file, just about nobody thinks of #including it. So, roughly, to reduce the number of support calls they had the resource editor generate it if it isn't defined yet.

Nobody includes winres.h because it isn't strictly part of the Windows SDK. First line reads: "// This is a part of the Microsoft Foundation Classes C++ library." It ships as part of the Windows SDK to reduce the number of support calls. Neither including it nor defining a preprocessor symbol called IDC_STATIC are mandatory (while the latter is at least useful).
https://stackoverflow.com/questions/379 ... rce-h-file

Cada controle Windows recebe um número, pra tratamento pelo programa.
Se não interessa tratar, é onde entra o IDC_STATIC, e o -1 seria algo como "sem número".
Como exemplo citam o texto (label), onde apenas mostra e não tem clique e nem nada de especial pra ser controlado.
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

Dialog em resource com mingw

Mensagem por JoséQuintas »

When creating child controls by calling CreateWindowEx, you have to assign a control ID (through the overloaded hMenu parameter). The control ID can later be used to refer to a control, without having to store the dynamically created HWND (e.g. when calling GetDlgItem or GetDlgItemInt).

Some controls rarely need to be identified in code. A prominent example is the Static Control1, that, if defined in a resource script, usually does not need to be referenced in code. You (or the dialog manager) still need to pass a control ID when creating the control, even though you don't use it later on. For those controls you can pass the IDC_STATIC control ID, that is defined in a wizard-generated Resource.h file2.

1 Other examples include the Icon Control (a static control with the SS_ICON style), the Line Control (a static control with the SS_ETCHEDHORZ and SS_SUNKEN styles), or the GroupBox Control.

2 This is not a convention of the Windows API3. It is strictly a decision made by user code. You could use another ID value, or not define IDC_STATIC at all if you want, and use an integer literal in the LTEXT control statement instead: LTEXT "Filename", -1, 10, 10, 100, 100

3 Granted, the SDK header winres.h does define the preprocessor symbol IDC_STATIC as (-1), so if you do define it in your code, make sure to assign the same value to avoid any confusion.
Talvez interessante esta parte:
"NÃO é convenção da API Windows, é uma decisão particular feita pelo fonte do usuário, pode ser -1, um número, ou nada"
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Avatar do usuário
JoséQuintas
Administrador
Administrador
Mensagens: 20267
Registrado em: 26 Fev 2007 11:59
Localização: São Paulo-SP

Dialog em resource com mingw

Mensagem por JoséQuintas »

hummmmm.....

Provavelmente dá falta quando compila com -w3 -es2.
E compilando de outro jeito.... simplesmente ignora e deixa Nil
José M. C. Quintas
Harbour 3.2, mingw, gtwvg mt, fivewin 25.04, multithread, dbfcdx, MySQL, ADOClass, PDFClass, SefazClass, (hwgui mt), (hmg3), (hmg extended), (oohg), PNotepad, ASP, stored procedure, stored function, Linux (Flagship/harbour 3.2)
"The world is full of kings and queens, who blind our eyes and steal our dreams Its Heaven and Hell"

https://github.com/JoseQuintas/
Responder