|
leon de boer wrote: It's called the NON client area but sorry I don't use MFC enough to help.
Why is "the left bottom corner of the dialog box" called "NON client area"? 
|
|
|
|
|
Thought he wanted to draw in the frame which is non client .. that belongs to windows (the O/S) not the app (the client).
It's so easy to draw in the normal client screen area with MFC didn't think you could mess that up ... Anyhow he worked it out.
Moral never over-estimate the question being asked
In vino veritas
|
|
|
|
|
You just need to add the relevant resource to your dialog. Either by adding a manual resource statement like:
ICON IDI_APPLICATION, IDC_STATIC, 7, 7, 20, 20
, or via the Visual Studio resource editor.
Perhaps if you explain clearly what the problem is we may be able to offer further suggestions.
|
|
|
|
|
Thank you for the reply. After a lot of trial and error and following the guidance. I got what I wanted. 
|
|
|
|
|
I need to save space and reduce some of my function pointers from 32-bit to 16-bit and this is ok since the flash region I've specified in the linker script is only 32 kBytes. Does anybody know how I can make my 3rd example below compile properly?
typedef struct {
uint16_t myFunctPtrTruncated;
} myUint16struct_s;
typedef struct {
void* myFunctPtr;
} myVoidstruct_s;
static void myDummyFunc() {}
myVoidstruct_s myStruct1 = { myDummyFunc }; myUint16struct_s myStruct2 = { 0 }; myUint16struct_s myStruct3 = { (uint16_t)(uint32_t)myDummyFunc };
|
|
|
|
|
I just tried this with Microsoft's Visual C++ compiler and it compiles cleanly.
|
|
|
|
|
I am using System Workbench (=gcc?) and I get error (not warning) message "initializer element is not constant".
|
|
|
|
|
arnold_w wrote: I am using System Workbench (=gcc?) A pity you did not mention that in your original message.
|
|
|
|
|
Are you sure you are using the right tools for (cross?) compilation? The compiler should be aware of the target addressing modes and adjust the pointers size accordingly.
|
|
|
|
|
Your statement 3 as written will only compile in C++ it isn't valid C code.
Which is why the person who tried it on VC++ it worked.
In C "myDummyFunc" can not be typecast to an address like in C++, in C "&myDummyFunc" is the pointer address that needs typecasting
Remember what that pesky "&" character means in C
The first case you list was defined as valid in C99, but your 3rd case is junk and correctly rejected
So try proper C code using the "&" so it understands what you are trying to do
myUint16struct_s myStruct3 = { (uint16_t)(uint32_t)&myDummyFunc };
Now if you want to do it properly so its portable the correct way is to use uintptr_t for the translation and C99 dot format
This allows you move the pointer anywhere within the struct and it sets correctly
myUint16struct_s myStruct4 = { .myFunctPtrTruncated = (uint16_t)(uintptr_t)&myDummyFunc };
In C99, uintptr_t will put some safety around your code because it is defined as
an unsigned integer type with the property that any valid pointer to void can be converted to this type, then converted back to pointer to void, and the result will compare equal to the original pointer
In vino veritas
modified 23-Oct-19 8:28am.
|
|
|
|
|
I still get the same error message.
|
|
|
|
|
Set the compiler flags -std=c11 or -std=c99 either standard will accept the code
The portable case has to work or you are on an old C89 compiler which I find odd given it accepts the shortcut syntax in 1
The only other choice is you are on something like a PIC where you have to use builtins to get function addresses because of the crazy 32K block arrangements on memory
In vino veritas
modified 23-Oct-19 8:40am.
|
|
|
|
|
Is there any reliable location in windows registry that tell if the architecture of the machine is AMD or Intel ? If there is, where is this location ?
I know this location:
HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0
and Identifier key, but my machine is Intel ... and I don't know what would be this value on AMD case ... is this a reliable location ?
P.S. Also, I know that I could find here:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
PROCESSOR_ARCHITECTURE has AMD64 value, even if I have Intel machine ...
modified 22-Oct-19 15:17pm.
|
|
|
|
|
Can you do something like:
SYSTEM_INFO si;
GetSystemInfo(&si);
TRACE(_T("%u\n"), si.wProcessorArchitecture);
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"You can easily judge the character of a man by how he treats those who can do nothing for him." - James D. Miles
modified 22-Oct-19 16:08pm.
|
|
|
|
|
Thank you, but the request is to get this value from registry, not from API.
|
|
|
|
|
The information can also be found by the following powershell command:
PS C:\Users\rjmac> Get-WmiObject Win32_Processor
Caption : Intel64 Family 6 Model 142 Stepping 9
DeviceID : CPU0
Manufacturer : GenuineIntel
MaxClockSpeed : 2701
Name : Intel(R) Core(TM) i5-7200U CPU @ 2.50GHz
SocketDesignation : U3E1
|
|
|
|
|
Yes, I could do that even with cmd, but I need to do this task with my code (VC++).
|
|
|
|
|
Then I guess the registry key that you already referred is what you need to look at.
|
|
|
|
|
Then someone who has AMD processor could take a look on that location and tell me what value has PROCESSOR_IDENTIFIER key (on location: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment ) 
|
|
|
|
|
You could always try and find someone where you are who has an AMD system.
|
|
|
|
|
Maybe it is just a feeling, but is hard to find on someone who has AMD processor.
|
|
|
|
|
What problem are you actually trying to solve?
|
|
|
|
|
To know what is there, in PROCESSOR_ARCHITECTURE and PROCESSOR_IDENTIFIER from HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment when machine has AMD processor.
|
|
|
|
|
Yes, but what problem are you actually trying to solve?
|
|
|
|
|
To know from registry if the machine has AMD or Intel processor. I guess is possible that.
|
|
|
|