|
Programm3r wrote: How does one convert SYSTEMTIME to char *
memcpy i.e.
char *charMem = new char[sizeof(SYSTEMTIME)];
memcpy(charMem,sysTime,sizeof(SYSTEMTIME));
"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 and You
|
|
|
|
|
Hello All,
In my dialog box, I want to use an image on a button, so I made it as Owner Draw, I use CBitmapButton class and it is working fine. But when ever the dialog comes up, the initial focus is on the user defined button only. Here is the code for bitmap button
CBitmap bmp;<br />
BITMAP bm;<br />
bmp.LoadBitmap (IDB_ENABLE_BMP);<br />
bmp.GetBitmap (&bm);<br />
m_oMyBtn.SetWindowPos (NULL, 0, 0, bm.bmWidth, bm.bmHeight, SWP_NOMOVE | SWP_NOOWNERZORDER);<br />
m_oMyBtn.LoadBitmaps (IDB_ENABLE_BMP, IDB_SEL_BMP, IDB_FOCUS_BMP, IDB_DISABLE_BMP);
I found when ever I use "SetWindowPos" the initial focus is always on the owner draw button. If I remove "SetWindowPos" function then the focus is as per my tab order settings.
My idea is to resize the button as per the image size. If any other way to do that let me know.
Thanks for your time
BlrBoy
|
|
|
|
|
Hi BlrBoy,
Try using SWP_NOZORDER in your SetWindowPos function. This retains the Z-order of the control.
Hope that helps.
Kiran.
|
|
|
|
|
I am working on a project in C++/MFC that requires me to add custom buttons to Word 2007. I have been able to find tons of information using VB and C#, but nothing in C++ and only for creating a project from scratch. Anyone have any suggestions?
|
|
|
|
|
Hello,
I have creating a window with my menu which done in the following code
CreateMenu();
AppendMenu(MF_STRING, id_Data, "Data");
AppendMenu(MF_STRING, id_Edit, "Edit");
AppendMenu(MF_STRING, id_Entity, "Entity");
The above code works fine.
Now I want to add a popup menu to Data menu
How should I do That ?
Thanks
Pritha
|
|
|
|
|
Hi Paritha,
Here is a sample code:
<br />
CMenu menu;<br />
menu.CreatePopupMenu();<br />
<br />
menu.AppendMenu(MF_STRING, 10, "item 1");<br />
<br />
CPoint pt;<br />
GetCursorPos(&pt);<br />
<br />
CMenu menu1;<br />
menu1.CreatePopupMenu();<br />
menu1.AppendMenu(MF_STRING, 11, "Item 1 in submenu1");<br />
<br />
menu.AppendMenu(MF_POPUP, (UINT_PTR)menu1.m_hMenu, "Submenu1");<br />
menu.TrackPopupMenu(TPM_RETURNCMD, pt.x, pt.y, this);<br />
Hope that helps.
Kiran.
|
|
|
|
|
prithaa wrote: AppendMenu(MF_STRING, id_Data, "Data");
AppendMenu(MF_STRING, id_Edit, "Edit");
perform same on hadle return after call of AppendMenu
"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 and You
|
|
|
|
|
Hello,
Thanks for your replies
And the code given by kiran did not work for me because I already have a menu with 3 menu options and now I want one of the menu options to have a popup menu attached to it which earlier was MF_STRING.
CMenu M;
M.CreateMenu
M.AppendMenu(MF_STRING, id_DAta, "Data");
M.AppendMenu(MF_STRING, id_Edit, "Edit");
M.AppendMenu(MF_STRING, id_Model, "Model");
Now the above works.
How should I have popup menu like the following attached to Data. I do not want to add to the 3 menu options above
CMenu M1;
M1.CreatePopupMenu
M1.AppendMenu(MF_STRING, id_Data1, "Data1");
M1.AppendMenu(MF_STRING, id_Data2, "Data2");
M1.AppendMenu(MF_STRING, id_Data3, "Data3");
Thanks
Prithaa
|
|
|
|
|
how to set the highest priority to socket program.
|
|
|
|
|
sakssp wrote: how to set the highest priority to socket program.
Why do you think you want to boost the priority?
Chances are that the error you're trying to "correct" by tweaking the priorities is a design flaw.
Tweaking the priorities of threads and processes is almost always wrong, or at least the wrong tool for the job. Don't mistake Windows for a real-time OS.
When you write it like that, I read it like "how can I disguise my error to make it even harder to track down".
What seems to be the most common mistakes when developing socket applications are...
- CSocket is used without the developer knowing that CSocket is a blocking implementation. Converting to CAsyncSocket is usually the medicine for this.
- CSocket and/or CAsyncSocket is used in a multithreaded application and worker threads are used instead of UI-threads. The threads that the sockets reside in have to pump messages and thus must be UI-threads.
See here[^] to get some more ideas.
If you neither find this post nor the link above helpful, post again and describe what you're trying to accomplish and what you've done so far. Especially if you still think you need to tweak the priorities of your process and its threads.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Another alternative to Roger's excellent suggestions.
Use Winsock directly instead of using the wrapper classes. Then you can implement an event-
driven model instead of using window messages for asynchronous socket communication. Then
you don't need UI threads.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Can any explain me diff ways of obtaining DCs.
In my problem, I have to draw some geometric figure from a function(methode)
where i dont have DC.
Thanks in advance!!
|
|
|
|
|
|
no,
i m not getting DC using GetDC...
|
|
|
|
|
Do you want to draw on it on MainWnd or On any other window or dialog?
|
|
|
|
|
With Win32 function ::GetDC(NULL) you can get the handle of the screen DC.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Hi,
Always draw on OnDraw(), and / or OnPaint() (MFC).
From Outside these function call RedrawWindow() to update.
|
|
|
|
|
It depends on what you need a DC for (what you want to draw on).
A DC is a "device context". It represents the drawing attributes of a device.
If you need a DC to draw in the client area of a window you can use GetDC();
If you want to be able to draw on an entire window (not just the client are) there's GetWindowDC().
To draw anywhere on the screen, either of the above can be used to obtain a screen DC.
For non-screen-related devices there's CreateDC()
For drawing to memory there's CreateCompatibleDC();
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi Folks,
is there a cheap trick to show document views of a MFC MDI Application outside the mainframe of the application?
The goal is to run the application in a dual monitor environment (extended desktop setting) so that the mainframe can stay on one screen while a document view can be moved to the other one.
Thanks for your help!
Regards,
Andreas
|
|
|
|
|
I'm not sure MFC can do that, but the first place I'd look is playing with the window styles.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Thanks for the idea, but my experiments didn't work out. MFC seems to be restrictive what window styles are set and also who the parent window is.
The best option I found for this works like described
here[^].
I believe there is also a code project article explaining this method but I can't locate it right now.
|
|
|
|
|
how to get the 3d effect window in domodal of propertysheet
WS_EX_CLIENTEDGE in domodal ?
www.tamilselvan.zoomshare.com
|
|
|
|
|
In Document View Architecture where the Objects of
1.Document
2.View
Objects are Getting Created ?
plz help me .
|
|
|
|
|
|
Those objects get created in the app's InitInstance() method.
BTW, you only waited 1.3 hours before asking this same question again. Be patient. Not everyone has had a chance to see it.
"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
|
|
|
|