|
bryce wrote: gives you a Cwnd pointer to the window in question ...from there i;d be looking at the help files for information about how to get pointers to child windows
FindWindowEx
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief
|
|
|
|
|
Hello all. I have a DLL that is used among two different applications. So far, it was nice. However, they recently decided that the application should use some directory (for reading config files) if it is called from program "x" or other directory if the program is "y".
Now I know that with some registry flag or file (no multithread support is required) this will work. Yet I don't want to create extra files and registry keys and such.
So I was wondering, is there any way I can know which program is calling the DLL's functions? I was thinking something about some of the parameters of DllMain, but since I'm with MFC this time, I don't have DllMain, but CWinApp::InitInstance.
Any suggestion will be really appreciated.
Regards,
FG.
|
|
|
|
|
GetModuleFileName() will return the name of the executable( the HMODULE should be passed as NULL ). So I think with this you can distinguish the exe.
|
|
|
|
|
Yep, worked perfectly, thank you.
Might add that I thought on that function, but also thought that it would return me the name of the DLL...
|
|
|
|
|
hi, i wrote a multithread MFC dialog,
in my CMYTESTDlg class,i declared a static thread function and several static variable like param1.
the thread funtion uses the static variable, but i got error lke this during linking:unresolved external symbol "public: static long CMyTestDlg::param1"
(if i don't use static variable, the error will be something like illegal refernce)
what's gonig on? and how do i fix the error?
|
|
|
|
|
You have to initialize your static variables.
<br />
long CmyTestDlg::param1 = 0;<br />
|
|
|
|
|
i think i did initialized the variables,
here is my thread function
UINT __cdecl ThreadFunc(LPVOID pParam){//AfxBeginThread(ThreadFunc, this);
CMyTestDlg* me=(CMyTestDlg*)pParam;
me->param1 = 0;
....
}
|
|
|
|
|
You need to define the static variable, as Cyrilix showed (outside of the class declaration).
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
|
alberthyc wrote: me->param1 = 0;
if param1 is static variable you should call it like this
CMyTestDlg::param1 not me->param1. as static variable not linked with object
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief
|
|
|
|
|
Hi,
I got an activex control which works fine in debug build but the same is showing 'memory not enough' problem in release mode.
Please advice.
Thanks in advance.
Regards,
John.
|
|
|
|
|
Probably start with all the compiler and linker settings and their differences.
You can also have debug info attached in a release build and run it in the debugger.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Probably start with all the compiler and linker settings and their differences.
<<
I gave all the setting of the debug mode to the release mode. Still the bug
persists.
>>
You can also have debug info attached in a release build and run it in the debugger.
<<
If i tick on the 'Generate debug info' in the Project>Settings>Link for the release setting i cant set up a break point. It will get disabled.
>>
Thanks for your attention.
Kind regards,
John.
|
|
|
|
|
Do you have debugging info turned on for the compiler as well?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Please can anyone tell me how to get and change the contrast/colour/brightness of the screen in C++/MFC.
TIA,
Andy
|
|
|
|
|
The first thing to figure out is how to do it without code. From there, you can start searching through a smaller set of APIs.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi,
I'm not sure what your getting at, without code I'd just do:
Display properties->Settings->Advanced->Color and change it there
However searching for these just brings out code which changes the display settings for the app rather than the actual settings in windows.
Andy,
|
|
|
|
|
mcsherry wrote: I'm not sure what your getting at, without code I'd just do:
Display properties->Settings->Advanced->Color and change it there
That's exactly what I was getting at (which will become clearer in time). However, I have a Color Management tab, and on that tab I see nothing for screen brightness, color, or contrast. Do you have something different?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
In addition to the Colour Management tab I have a Colour tab which allows me to manually change the settings.
ok so far I've tried:
CDC *win = GetDesktopWindow()->GetDC() ;
COLORADJUSTMENT col_adj ;
win->GetColorAdjustment ( &col_adj ) ;
col_adj.caBrightness = 100 ;
int err = win->SetColorAdjustment ( &col_adj ) ;
this does return the correct settings for the system however the Set method doesn't actually change anything *that I can see* so I'm assuming I'm looking at the wrong area and changing the wrong settings
|
|
|
|
|
mcsherry wrote: In addition to the Colour Management tab I have a Colour tab...
Since I cannot reproduce this, you'll need to find which registry keys are changed by the controls on the Color tab.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
DavidCrow wrote: Since I cannot reproduce this
Nor I. Could be driver provided for the specific monitor (video card DUH ).
|
|
|
|
|
You can use GetDeviceGammaRamp() and SetDeviceGammaRamp() to change monitor brightness on videocards that support it. More information in the MSDN: http://msdn2.microsoft.com/en-us/library/ms536529.aspx[^]
All you have to do is call GetDeviceGammaRamp() and iterate through all 256 WORDS and increment them. Higher values == higher brightness.
-Randor (David Delaune)
|
|
|
|
|
cheers, does what it says on the tin!!!
Andy,
|
|
|
|
|
Is it possible to display a small image on a button? Together with a text?
Is it possible in VC++6?
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
Start here.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|