|
When I create a MFC application using the wizard and choose it to be maximized and with no maximize button the status bar seem to be misplaced (below the windows task bar?). When I hide my windows task bar and un-hide it again then the status bar is correctly placed. Help appreciated. Thanx
|
|
|
|
|
Can a rich edit control show images and background colors used in .rtf file.
We Believe in Excellence
|
|
|
|
|
|
I don't know how to correctly acquire the device context for a control. If I put similar code in the OnCtlColor routine where a pointer to the device context is provided, the code works. However, when I try setting the device context, the code doesn't work. Two samples are provided - the first is the code that doesn't work. I appreciate any help fixing it. Thank-you.
This code compiles and runs without error, but does not achieve the color change. (c_navValid is a text box control)
LOGFONT lf;
CDC* dc = new CDC;
dc->Attach(c_navValid.GetDC()->m_hDC);
GetFont()->GetObject(sizeof(lf), &lf);
font.CreateFontIndirect(&lf);
dc->SelectObject(&font);
dc->SetTextColor(RGB(0,100,0));
font.DeleteObject();
This code works.
HBRUSH CNavDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
W_Position_Data_Type* pPositionMsg;
pPositionMsg = (W_Position_Data_Type*)&CInMsgs::wPositionMsg;
HBRUSH hbr = CPropertyPage::OnCtlColor(pDC, pWnd, nCtlColor);
if (pWnd->GetDlgCtrlID() == IDC_NAV_VALID)
{
if (pPositionMsg->Mode_Word.Nav_Valid)
{
LOGFONT lf;
GetFont()->GetObject(sizeof(lf), &lf);
font.CreateFontIndirect(&lf);
pDC->SelectObject(&font);
pDC->SetTextColor(RGB(0,100,0));
font.DeleteObject();
}
}
|
|
|
|
|
Use CClientDC or CWindowDC to get a DC for a window. Use the former to draw in the window's client area only, or the latter if you need to draw in the non-client area too.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | 1ClickPicGrabber | NEW~! CP SearchBar v3.0 | C++ Forum FAQ
Wizard needs food, badly!
|
|
|
|
|
Could you please show me the code? To use CClientDC I need a pointer to a window. How do I convert the static control to a window pointer? cCliendDc dc(c_navValid); I know isn't correct. What parameter do I pass to CClientDC to get a dc for the control? Thanks.
|
|
|
|
|
Does anyone know how can I embedd some text into an existant PDF that can indexed by search engines?
I want to hide the embedded text but search engines can index it.
Best regards,
A. Riazi
|
|
|
|
|
Hello,
Can anyone know how can I query windows for its devices.
What I mean is that my program needs to know which modems are installed on the pc and thier ports, etc..
The windows device manager is a good example, I want to know how to get data the device manager displays.
Thanks
Y.R.
|
|
|
|
|
|
Thank you very much.
After posting this message I searched in code project and indeed got to your article "Enumerate Installed Devices Using Setup API[^]". I loved it very much very intresting.
I will read the second one now.
Regards
Y.R.
|
|
|
|
|
A. Riazi
|
|
|
|
|
hi guys,
I need a help.
How to set height of Edit Control?
Please let me know if you have any advices or solutions.
Thank you very much!
Best Regard,
KHLin.
|
|
|
|
|
You can set the height/width of the edit control using any of the following
mehtods.
BOOL MoveWindow(HWND hWnd,
int X,
int Y,
int nWidth,
int nHeight,
BOOL bRepaint
);
HWND CreateWindow(LPCTSTR lpClassName,
LPCTSTR lpWindowName,
DWORD dwStyle,
int x,
int y,
int nWidth,
int nHeight,
HWND hWndParent,
HMENU hMenu,
HINSTANCE hInstance,
LPVOID lpParam
);
Cheers,
Vishal
|
|
|
|
|
I use function shellexecute (0, "open", "filename", "", "path", SW_SHOW) to execute a program and it runs ok. But I want to get the HWND (handle) of this executed file so that i can hide, minimze, or close it. Please help me how to code (in win32 api) to get the HWND. Thanks.
|
|
|
|
|
Hi,
You can get HWND for the application you are opening through "ShellExecute"
using following technique
Psedo code:
ShellExecute(GetDesktopWindow(), "open", "filename", "", "path", SW_SHOW)
EnumChildWindows(GetDesktopWindow(), CallBackChildWindows, lParam)
CallBackChildWindows(...)
{
int iRet;
//Get the class name of the window
iRet = GetClassName(hwnd,strClassName,..)
if(iRet!=0)
{
//You must be knowing the class name for the application, which you are
//opening through the SheeExecute. So match the class name here, once
//match the class name exit from this proc.
//arrStrClassNames would have all the class names
if(strClassName==arrStrClassNames[iIndex])
return false
else
return true
}
}
Still facing problems ?
Cheers,
Vishal
|
|
|
|
|
What about Creating Process using CreateProcess Api,Which give Ultimate Control of Process creating Application to control the new born process.
have a look at this article:-
http://www.codeproject.com/system/newbiespawn.asp[^]
"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
|
|
|
|
|
Also look at ShellExecuteEx instead of ShellExecute
|
|
|
|
|
I have this C++ course and I have creatd a linked list with methods to insert and remove. The program works fine for me but for my instructor it crashes, for him, most likely since he uses his version of main. I can't trobleshoot my version, that easy, since it works. What I suspect is that my remove method wants an actual parameter of a pointer that points to a real address,(not null) and perhaps my instructors main is only sending a pointer. Is it possible to send a pointer, (of a user defined data type UDT) to a method and have that method set what this calling parameter will point to? I hope this makes sense. I have been spending many hours trying to learn all the ins and outs of pointers.
Thanks
If only I had more time!
|
|
|
|
|
Have you tried passing bad values to your methods. Like trying to remove the same element more than one time? If you remove all emements in your main does it crash?
bitsNbites wrote:
I hope this makes sense.
Not fully.
John
|
|
|
|
|
Did you compile and run under Debug mode? And your instructor built and run in Release mode?
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
Hi,
I am trying with a program that will create an ActiveDesktop. I want to manipulate the buttons on ActiveDesktop which is intented to manipulate the state of the ActiveDesktop as IS_NORMAL, IS_FULLSCREEN, IS_SPLIT. Is there any option for doing it programically?
I am using IActiveDesktop to manipulate the ActiveDesktop.
Waiting your responses
Vinod
|
|
|
|
|
I have tried using RegisterHotkey for Windows XP to disable Alt-Tab and it worked properly. But when i tried using the same code for Windows 98, the Alt-Tab is still working. How do you do this in Windows 98? Thank You.
|
|
|
|
|
|
Global keyboard hooks would do the trick for you.
Cheers,
Vishal
|
|
|
|
|
messages like ON_EN_SETFOCUS for a CEdit Control is typically sent through its parent,ryt?
This is the situation of CControlBar->Intermediate CWnd->CEdit..
CControlBar is docked on a CMainFrame... CEdit's parent is an intermediate CWnd..
I want SetFocus notifications and ENTER key presses to be handled by CControlBar or on the CMaiNFrame.. is there anyway i can do these?
regards,
Maverick
|
|
|
|