|
can hdc be passed between processes?
dont want,dont want thinking,climbing on head and jumping grass!
(venda venda ennu vicharikumbol thellayill keyaree chadunnoda pulle!)
|
|
|
|
|
I don't think so, but in general it's not a problem: simply conjure up one in the target process from the HWND in question (HWND s can be shared between processes).
Steve
|
|
|
|
|
Hi all,
Anyone can tell me how can set back image in ListCtrl while view of ListCtrl is Report view.
Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
I haven't tried it but isn't CListCtrl::SetBkImage good enough? Have you tried this?
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Hai,
I am very new in VC++/MFC Programming. I have a problem to load a high resolution icon and Png Image to toolbar. How can i load. please tell me any article or help with examples link.
Regards
Bagavathikumar
Bagavathikumar
|
|
|
|
|
|
You can test with follow code lines:
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP
| CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
!m_wndToolBar.LoadToolBar(IDR_TOOLBAR))
{
TRACE0("Failed to create toolbar\n");
return -1; // fail to create
}
//m_ImgList is a variable type CImageList
m_ImgList.Create(32, 32, ILC_COLOR32, 0, 10); //ILC_COLOR32 specifies the high color of 32 bits
m_ImgList.Add(AfxGetApp()->LoadIcon(IDI_ICON1));
m_ImgList.Add(AfxGetApp()->LoadIcon(IDI_ICON2));
m_ImgList.Add(AfxGetApp()->LoadIcon(IDI_ICON3));
CToolBarCtrl& tbCtrl = m_wndFormatBar.GetToolBarCtrl();
tbCtrl.SetImageList(&m_ImageList);
|
|
|
|
|
Can anyone help me on how to create log file in Visual C++ with MFC???
|
|
|
|
|
log files are just simple text files unless you want to create complicated ones. I usually enter the date/time at the beginning of the log entry and then the file name, function name and the Log message. You can use normal fstream objects to write to the file. The log function should open the log file, write the log entry then close it again.
In case you are looking for something complicated try to create a service for logging messages to a log file.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
|
cb02061 wrote: Can anyone help me on how to create log file in Visual C++ with MFC???
In exactly the same way as you would any other file. What name you give the file, or what you put into it, is irrelevant.
Hint: see the CFile class.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
This is so terribly embarrassing. An old dog like myself shouldn't be asking such stupid questions, but for the life of me I'm can't find the right switch to flip. Of course, I knew I was in trouble when I heard myself mutter, "All I wanted to do was..."
IE7 has a convoluted Ctrl+Alt+F4 combination to close all but the current tab (best as I can determine from Google, etc., there is no Tabs API, bizarre as that may be). So, in a toolbar I wrote, I simply wanted to add a button so the user could click to close all tabs instead of playing a game of Twister with their fingers. WM_KEYDOWN, SendInput, Get/SetKeyboardState, I've screwed around with all of this, but I can't seem to find the proper approach to send this particular keystroke combination. Of course, it's the combination of Ctrl and Alt that is the complicating factor.
So, how 'bout it - any of you old dogs (or all the young dogs who are much brighter than I am) know how to accomplish this? It really feels like one of those solutions that's going to be so simple as to make me feel quite inept once discovered, but hey, I've been there before.
Thanks for any insights you might offer.
|
|
|
|
|
I don't know how to send keys but there is an article KeyStrokeEngine[^]. I just tried the demo application and it can successfully send CTRL+ALT+F4 to IE. Maybe looking into source will tell you how to post a message yourself.
-Saurabh
modified on Tuesday, April 29, 2008 10:36 PM
|
|
|
|
|
Hi, Saurabh.
I looked over his code, seems to be a nice piece of work. Reviewing it put me onto keybd_event(), which is an approach I hadn't been aware of (probably because it's been superceded by the somewhat more convoluted SendInput()).
keybd_event() is pretty straightforward to use, and when I plugged in the key down and then key up calls for control, alt and F4, it worked like a charm.
For those who may be interested, here's the snippet that got it done:
<br />
keybd_event(VK_CONTROL,0x9d,0 , 0);<br />
keybd_event(VK_MENU,0xb8,0 , 0);<br />
keybd_event(VK_F4,0,0 , 0);<br />
<br />
keybd_event(VK_CONTROL,0x9d,KEYEVENTF_KEYUP,0);<br />
keybd_event(VK_MENU,0xb8,KEYEVENTF_KEYUP,0);<br />
keybd_event(VK_F4,0, KEYEVENTF_KEYUP,0);<br />
Thanks very much for taking the time to help me - I do appreciate it!
|
|
|
|
|
Hey Chris,
You are most welcome and thanks for the code snippet.
-Saurabh
|
|
|
|
|
Hello sir.
It looks like your problem is solved. Good to know about that. I was really surprised to see you post a question here. Honestly, I never ever thought that I will see someone like you to post a question here.
BTW, I have been a great admirer of your articles.
Regards,
Vijay.
|
|
|
|
|
Hi, Vijay.
Thanks for the kind words, man - glad you enjoy my ramblings.
As for asking questions, hey, I'm just a geek like everyone else around here. Some days are good, some days are okay, and some days the screen turns a particularly interesting shade of the color blue.
|
|
|
|
|
When I entered the forum here today, I saw your post at the top and just asked myself -"Am I in the Lounge?". I had to check once to make sure that I was in the C++ forum and not in the Lounge.
Christopher Duncan wrote: hey, I'm just a geek like everyone else around here. Some days are good, some days are okay, and some days the screen turns a particularly interesting shade of the color blue.
Yes, but I believed that people with reputation as high as yours either don't face any problem while programming or they restrain themselves from asking for help here if they face any. But its really nice to see you post a question and ask for help here.
Regards,
Vijay.
|
|
|
|
|
The biggest wisemen are always those that know where their limits are and are not afraid to recognise that they have errors/questions as the rest of the "mortal" people, although less
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Hi,
I am using VC++ 6.0 . I have one MDI application which has Diaglog Bar on the left which has tree control on it. Now when I double click one of the leaf in the tree, it opens the child window. This child window will have Edit Box. I have set the focus to the Edit Box when it opens using the following line.
PostMessage( WM_NEXTDLGCTL, (WPARAM)pEdit->GetSafeHwnd(), (LPARAM)true );
Now along with that, the Edit Box text is also selected which I don't want.
I just want the focus to that edit box. And if possible then cursor at the
end of the text in the edit box.
To remove the selection I have added following line after the PostMessage line:
m_Edit1.SetSel( -1, 0 );
But the selection does not remove/disappear. I have tried different SetSel function ranges but whole text remain selected.
Please let me know, how to remove the selection in this case?
Thanks,
|
|
|
|
|
Finally I found the solution .
I made an event on Edit i.e. OnSetfocusEdit1() and add the following line and it is working. If I add that line out side this function then it is not working.
m_Edit1.SetSel( -1, 0 );
Thanks
|
|
|
|
|
Member 4538510 wrote: This child window will have Edit Box. I have set the focus to the Edit Box when it opens using the following line.
PostMessage( WM_NEXTDLGCTL, (WPARAM)pEdit->GetSafeHwnd(), (LPARAM)true );
Are you Posting the message from the child window? If so why do you want to post a message from the child window when you can get a handle to the edit box?
Member 4538510 wrote: To remove the selection I have added following line after the PostMessage line:
m_Edit1.SetSel( -1, 0 );
If you are posting the message from the dialog bar, calling SetSel() will not have any effect. You need to call SetSel() inside the child window
Yusuf
|
|
|
|
|
Thanks Yusuf,
I am not Posting the Message from child window. I am posting from the DialogBar on the left on which Tree is placed. From the Tree leaf I am opening the child window thus require PostMessage.
Thanks,
|
|
|
|
|
Hello all,
I have a CDialog-based application with a set of controls on the top half that do not change. On the bottom half, I would like to add a panel of controls that I can change based on some state within the application. The number, size, and functionality of the controls on each individual panel will be completely different for each panel. Basically, I would like the functionality of a CTabControl (CPropertySheet/CPropertyPage?), but without the tabs. It would be convenient to have a resource template for each panel, like in a CTabControl, but I would like the controls to look as if they are actually on the dialog, rather than on a Tab. Can someone suggest a method of doing this? Also, please tell me if this violates some major paradigm of MFC! I don’t want to just hack something together; I want it to be maintainable!
I hope my question made sense. Thanks in advance for your help!
+-------------------------------------+
| |
| Other application Controls |
| |
| |
| +----------------+ |
| | Panel of | |
| | state-specific | |
| | controls | |
| +----------------+ |
+-------------------------------------+
|
|
|
|
|
There might be a nice, clean resource file way to do this, but over the years when I've been faced with such a task, I ended up writing the code by hand in the dialog class. By that I mean that I dynamically allocated the CButton, CEdit and such controls, and then set their position / hid them / displayed them / etc. in code.
One method I used was a group box control that was always visible, i.e. your bottom panel, which gave me a relative reference point to use in positioning the other controls. It's maintainable, but frankly it was never something I was proud of. However, there's always these darned deadlines, and it got the job done.
I don't know if this is the sort of thing you're looking for or not (and there may be more elegant solutions), but it's at least one option open to you.
Hope this helps,
|
|
|
|
|