|
using WM_CTLCOLOR causes problems in other parts of my code. is there any other solution?
|
|
|
|
|
It should not affect other parts of your code.
Here is a sample of my code.
HBRUSH CMyView::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CFormView::OnCtlColor(pDC, pWnd, nCtlColor);
INT nIDCtl = pWnd->GetDlgCtrlID();
switch(nIDCtl)
{
case IDC_STATIC_CTRL1:
{
pDC->SetBkColor(RGB(255, 255, 255));
CBrush br;
br.CreateSolidBrush(RGB(255, 255, 255));
hbr = (HBRUSH)br;
br.Detach();
}
break;
case IDC_STATIC_CTRL2:
....
....
case IDC_STATIC_CTRL3:
....
....
case IDC_STATIC_CTRL4:
....
....
}
return hbr;
}
|
|
|
|
|
|
SetBkColor() should be used when handling a WM_PAINT message or within a control's DrawItem() override. Use it to set the background color of the DC for the duration of the painting action.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
even if i use setbkcolor in WM_PAINT is does not do anything.
|
|
|
|
|
I have a SDI project where a user using the menu can select and load another window object. I get the new window, but it is on top of my main window. I want to be able to move the window away from the main window.
This is the code I use to create and show the window:
pStatus->dlg.Create(IDD_FORM_STATUS);
pStatus->dlg.ShowWindow(SW_SHOW);
Can someone help me out?
Thanks.
Jerry
|
|
|
|
|
One solution is MoveWindow().
Kuphryn
|
|
|
|
|
hi!
im a newbie with MFC & hope someone can help me with this...
i hv created 2 MFC dialog based programs and need to integrate them together... ie. after integrating, when i click on build on execute, the 2 dialogs shld appear together on the screen.
i've tried using a modal dialog box in program A so as to contain program B but created a mess n it's not functioning too.. as the 2 dialog dialog boxes need not communicate w each other, i wonder if there is a better suggestion?
|
|
|
|
|
Use Modeless Dialogs...
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
Hi!
I have projects and DLLs made with Visual C++6 and I try to pass to Visual C++7.
I have a link error when I use a function (contained in a DLL) that uses a CString as parameter.
ERROR LINK 2019 non resolved symbol CStringT ...
Everything was alright with VC++6.
How to solve my link problem?
Will any other problems happen soon during the passing of VC++6 to VC++7???
Thanks.
|
|
|
|
|
Hi all
does ne1 know the easist way of deleting a file
i have a txt file which i need to remove in certain situations
i tried using
remove(str_SettingsPath);
but that doesnt work
any ideas ??
si
|
|
|
|
|
Use unlink() , CFile::Remove() or DeleteFile() . Be sure to specify the file's full pathname.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
si_69 wrote:
i tried using
remove(str_SettingsPath);
but that doesnt work
It should, if used correctly. What value does it return? The file must not have the read-only (and probably the hidden) bit set. You must also have the right privileges.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
silly me, still had the file open while i was trying
to delete it
|
|
|
|
|
I first selected some files from an input directory, and then set the output directory to be some other location. Then I processed my input files and had it do a system() call for "dir/b > list.txt".
Its odd that it created the list.txt in the input files directory . I also checked with getcwd and sure enough it was the input directory. What is the reason for this?
Thanks,
sb
|
|
|
|
|
Working directories are specific to a drive. You're much better off using an API to get the list of files in a dir instead of calling system() .
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Ravi Bhavnani wrote:
...instead of calling system().
Agreed.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
How did you select the output directory? dir /b > list.txt WILL create a list.txt file on the current working directory. I am just curios to know how you set the output directory because there is no such function as setcwd(), unless you used chdir(). But if you did that then dir /b list.txt will work only on the new directory.
On the other hand, "dir /b > C:\...\outputDir\list.txt" will do the trick and probably you knew that already. "dir" command will take as parameters the full path to the input directory and the full path to the output directory.
i.e. dir c:\...\inputDir /b > c:\...\outputDir\list.txt
Some code posted here would help.
But just as the others did, I would recommend API.
// Afterall, I realized that even my comment lines have bugs
If the sun were to blow up, it would take us 7-8 minutes to realize it.
|
|
|
|
|
Hi all,
I want to track the printer messages send by any application.
I want to do this using windows Hook... but I dont know which Hooking message i should use here...
If anybody knows this please help me...
Thanks
|
|
|
|
|
Try the WH_CALLWNDPROC, WH_CALLWNDPROCRET or the WH_GETMESSAGE hook types.
Look for a message id of WM_PRINT.
Bikram Singh
|
|
|
|
|
I already use that, but it is not working....
I get the WM_PRINT message when i just click on the menu... and not when i press print command from menu...
I don’t know how this is happening...
Hear is my code...
LRESULT CALLBACK HookProc(int nCode, WPARAM wParam, LPARAM lParam)
{
// return immediately if system required
if (nCode < 0){
return CallNextHookEx(g_hInitMenuHook, nCode, wParam, lParam);
}
// get window procedure struct
CWPSTRUCT *wps = (CWPSTRUCT*)lParam;
switch(wps->message)
{
case WM_PRINT:
/// code for loging the print command
break;
}
return CallNextHookEx(g_hInitMenuHook, nCode, wParam, lParam);
}
I tried this HookProc for both WH_CALLWNDPROC and WH_GETMESSAGE... but it is not working
Can anybody suggest me any other way to trace the Print Command
Thanks
|
|
|
|
|
Hi,
I am using DC 's ScrollDC to scroll the contents of a custom control.
There are some problems though...
Whenever a window is hovering the control, the DC does not scroll the contents properly. Example:
Custom Control's pos/size: [0,0] - [100, 200]
Now imagine a window hovering at [75, 60] - [outbounds control]
The DC does not scroll from [75,0] - [100,60] !!!
Why?
Note: I am calling ScrollDC without passing (nulling) pRgnUpdate and lpRectUpdate (the last two parameters), as I don't really understand their meaning.
BOOL ScrollDC( int dx, int dy, LPCRECT lpRectScroll, LPCRECT lpRectClip,
CRgn* pRgnUpdate, LPRECT lpRectUpdate );
|
|
|
|
|
hi friends,
i m working on a radar display in vc++.i.e.i want to plot a trajectory using xyz coordinates.i have to display a number that should move with the trajectory.as i know the xyz co ordinates and the no as well, i m able to display it.but the problem is that as the trajectory moves the no should also move with it.so that the no now gets displayed on the new coordinates and the one that was on the last coordinates gets deleted.so that it also seems to be moving witjh the trajectory. i m displaying the no using textout function.if anyone can give some idea on how to delete the no on the previous points so that it gets erased as soon as we get the new coordinates or if there is some other method of displaying the no so that it is visible only on the current point.
waiting for a reply....
Aarti Vimal
Scientist 'B'
Defence research & Development Organisation,
Bangalore,
Karnataka,
India.
|
|
|
|
|
I once did something like this in 2D. I'm not sure if I <i>deleted</i> the textobject, or I drew a rectangle over it. I think it was the second though. Draw a rectangle over your text and draw new text @ new position.
good luck!
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
Keep track of the point's current coordinates. When the point moves, first overwrite the existing text using a pen whose color is that of the background, then write your new text.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|