|
Thanks tiaozi,
with your help (the code), I can correctly catch the Enter key press(VK_RETURN) and tell if it's caught by the parent dialog or the embedded child chialog. Now I realise when the app was initially load, the key press is always caught by the parent, although a button in the child dialog has been highlighted (here I'd think so the focus is set to the child dialog?).
Do you know how I can correctly set the focus to child dialog when the app is loaded? I've tried two different ways, none of them seem to work.
One is to place pChildDlg->SetFocus() in the parent class' OnInitDialog(). pChildDlg is the pointer to the child dialog that is showing.
Two is to place SetFocus() in the child class' OnShowWindow(), whether to the child itself (thus this->SetFocus(); ) or a control (in my case, to a CButton). Here as I mentioned earlier, when I SetFocus() to the CButton, I can see the button is highlighted as the app window is initially loaded. But when I hit "Enter" key, this input message is still caught by the parent?
|
|
|
|
|
OK, I got it working, with the second method (after some fix). I forgot to put ON_WM_SHOWWINDOW() message map in.
|
|
|
|
|
I know that TextOut method helps displays strings...what if i want to display integer/float? Do I have to convert it to string n use TextOut? Or is there another available method?
Thank you
|
|
|
|
|
i'm not sure if TextOut directely accepts integers, but you can use the 'Format' method of CString to construct a string from an integer (or float, double etc.). Hope this helps.
Er zit een korstje op mijn aars.
|
|
|
|
|
Thanks for d reply...just to confirm. So, there is no other method to display integers than to convert it to string. Is it?
Thanks again.
|
|
|
|
|
char buff[25];
sprintfbuff,"%d",m_yourInteger);
pdc->TextOut(buff);
hope this works for you, if you need some other stuff, do let me know.
regards
balkrishna talele
|
|
|
|
|
BOOL TextOutF(HDC hDC, int x, int y, LPCTSTR szFmt, ...)
{
TCHAR szOutput[512];
va_list args;
va_start(args, szFmt);
_vsntprintf(szOutput, 512, szFmt, args);
va_end(args);
return TextOut(hDC, x, y, szOutput, _tcslen(szOutput));
}
Now you can write:
int nMyInt = 34;
TextOutF(hDC, 0, 0, "my int = %d", nMyInt);
Output:
"my int = 34"
|
|
|
|
|
No, You have to convert it to a string and then print it. You can use CString Format method or wsprintf or sprintf and create the formatted string then use it to display the msg.
|
|
|
|
|
Hello Sir...
Sir..My requirment is to insert first page in Tiff which is created by user in CScrollView...
Please Suggest me any solution How can I do...
I'm using LibTiff...
As your've also used Libtiff in your project..this means u can better Suggest me...
I'm Very thankful to u if u provide me short function which convert SrollView to Image & place in Tiff as first Page...
Also I Suggest me How can I modify Tiff file...e.g: I want to change or Insert Text in Particular position In First Page of Tiff...
Please Guide me Sir..I'm trying to solve this problem from One week...
I hope U will help me...& I hope u will spare some time from your busy life & Reply me.....I'm waiting reply from U..
So Nice of U..that U listen my problem..& thinking its solution...
Thanks...Sumit
sumit_delhi
|
|
|
|
|
Hi, I hope that this doesn't sound stupid...
I'm currently in first year University... and I'm planning on becoming a software engineer. I picked up Visual Studio.net 2003, and so far I'm doing pretty good... except for one thing. Does anyone know how to statically link visual C++/C# programs when compiling, so that I can distribute the programs that I made to friends who do NOT have Visual Studio.net, or any other programming language for that matter?
Any help would be greatly appreciated.
Thank you.
Mike
|
|
|
|
|
When you disturbute ur binary you also need to disturbute the files that ur application depends upon, like support dlls n suff. you can find out on what all dll that ur app is depending upon by using either dumpbin or depends.exe
One way is to make a installer for you app... its not that difficult for a simple application, or provide all the dlls to your friend and put them in their necessary places.
My God is more powerfull Than Your God. (the line that divides the world)
|
|
|
|
|
For C++ projects, in the properties for the project, go to General. If using MFC, change "Use of MFC" to "Use MFC in a Static Library". For all C++ projects, go to the C/C++|Code Generation and change "Runtime Library" to a non-DLL option.
For C#, your users will need to download or somehow install the .NET runtime package. (It's 20MB, so they'll need a fast connetion if they download it.)
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
hi..i have a project, designing a pci driver using C++..where should i start?can some one give me an idea?which C++ is suitable for designing pci driver?...can someone help me? i really appreciate it a lot..
|
|
|
|
|
I assume you are working on windows and not linux.
nmelah wrote:
which C++ is suitable for designing pci driver
MS Visual C++ 5.0 or greater.
nmelah wrote:
where should i start?
Obtain the microsoft DDK.
John
|
|
|
|
|
If this is not a personal project, try to acquire Compuware's DriverStudio 3.0. This provides a C++ framework for writing WDM/Legacy drivers. This along with VC++ 6 (SP5) should give you a jump start.
|
|
|
|
|
|
;PHello all,
I am using CTreeCtrl and when creating items and I am storing a LPSTR into the lParam of the TVITEM struct. When I need to clear the contents I need to free the memory allocated but to get the pointers I need to traverse all items in the tree ctrl but could not find any easy way to do it. Can anyone guide me? Will the method that i write be recursive or can i write a non recursive function?
I need to get each item data in the tree and then free the memory and then I can call DeleteAllItems on the tree.
Thank you
Memory Leaks are very dangerous.;P
|
|
|
|
|
|
Micheal, If the treeitem contains child notes that has allocated memory for lparam, will i get notification for each childitem when i delete its parent item.
My God is more powerfull Than Your God. (the line that divides the world)
|
|
|
|
|
|
Wow, Thanx again micheal, this method replaced my (quite complex) recurrsive way of deleteing the child items
My God is more powerfull Than Your God. (the line that divides the world)
|
|
|
|
|
Thank you very much Mike works very well. I have read your articles on this site and find them very good. I admire you. Thanks once again.
But one more question I am using a ActiveX control and allocating it on the heap. I create it by calling Create(). When i free the memory the GDI object handles and USER object shown in process viewer decreases but not to the count it was before I do the creation operation If i try to call DestroyWindow() it gives assertion error. Why is it so? What should i do to decrease the GDI object and USER object count as it increases with usage time.
|
|
|
|
|
The most common mistake is forgetting to select pens/bitmaps/etc. out of a device context. For ex. if you do this (pseudo-MFC code here, since I'm in a hurry )
CPen p (RGB(255,0,0));
dc.SelectObject(p);
dc.MoveTo(0,0);
dc.LineTo(100,100);
p.DeleteObject(); the pen will not be deleted because it's still the active pen in a DC.
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber
You cannot truly appreciate Dilbert unless you've read it in the original Klingon.
|
|
|
|
|
Hi guys,
is there a way to have CButton defaulted as push button types (BS_PUSHBUTTON, BS_PUSHLIKE), when create/drop them in layout window? I couldn't seem to set it in property window, am I missing something?
Thanks
|
|
|
|
|
dereive a class from CButton as CMyButton. override the create method and pass the flags as required, then use ur button where ever cbutton is used. this way you can minimise the no of parameters passed to create a CButton.
My God is more powerfull Than Your God. (the line that divides the world)
|
|
|
|