|
Hi,
I am using VS 2008, VC++, MFC.
I am trying to draw the groupbox with a custom color and also choose my own color for the text displayed.
I would greatly appreciate if you could help me with this.
Thanks.
-A
|
|
|
|
|
See WM_CTLCOLOR* on the MSDN.
|
|
|
|
|
Hello dear friends,
I am creating the toolbar in VC 6.0.
I want to show the menu when the button of the toolbar will be clicked.
But when I use the LoadMenu for loading the menu from the resource i get
0 as the return value and GetLastError() returns the description
"The specified resource type can not be found in the image file."
I really don't understand the problem.The code snippest is as shown below.
void CMFToolbar::PopupFileMenu()<br />
{<br />
<br />
try<br />
{<br />
CMenu mnu;<br />
CMenu *submnu;<br />
RECT rectSubmitButton;<br />
if(!GetItemRect(CommandToIndex(IDB_FILE),&rectSubmitButton))<br />
{MessageBox("Fail1",_T("QpOffice Toolbar"),MB_ICONERROR); return;}<br />
if(!MapWindowPoints(HWND_DESKTOP,(POINT*)&rectSubmitButton,2))<br />
{MessageBox("Fail2",_T("QpOffice Toolbar"),MB_ICONERROR); return;}<br />
if(mnu.LoadMenu(IDR_FILE_MENU))<br />
{<br />
MessageBox("1",_T("QpOffice Toolbar"),MB_ICONERROR);<br />
}<br />
else<br />
{<br />
char buf[MAX_PATH];<br />
strcpy(buf,ErrorDescription(GetLastError()));<br />
MessageBox(buf);<br />
}<br />
}<br />
catch(...)<br />
{<br />
MessageBox("Exception",_T("QpOffice Toolbar"),MB_ICONERROR);<br />
}
Thanks in advance to all of you.
ritz1234
|
|
|
|
|
Is the menu resource in the module you're calling LoadMenu() from?
If so, is its id == IDR_FILE_MENU? If so, is it the same IDR_FILE_MENU
you use in the code?
Is this code in a DLL or an EXE?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks for the reply Mark
1)The LoadMenu and the menu resource are in the same module.
2)Its id is IDR_FILE_MENU
3)It a DLL.
I've got one other solution in which I am constructing the menu from the scratch instead of using the menu defined in the resource script.
It is working.
One question in this approach is how to add the things like the menuitem which belongs to the cursor should have foreground color differes from the background color.
ritz1234
|
|
|
|
|
So the Menu resource resides in Dll and you call load menu in Dll exported function and you use VS 6.0.
in the exported DLL function, call in the beginning.
AFX_MANAGE_STATE(AfxGetStaticModuleState( ));
[AFX_MANAGE_STATE^]
|
|
|
|
|
Thanks for handling all my answers this morning
Cheers,
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks mark
|
|
|
|
|
Hi,
I m' trying to integrate one of my sub-module applictaion(SDI)
into my major module..In such a case i m' getting the following
build error:
CVTRES : fatal error CVT1100: duplicate resource -- type:DIALOG,
name:130, language:0x0409
.\Debug\FINEART_V1.res : fatal error LNK1123: failure during
conversion to COFF: file invalid or corrupt
Error executing link.exe.
Kindly suggest me y it happens wats' the way of solvin tis error..
Gita
|
|
|
|
|
You've got duplicate ids in your .rc file.
Steve
|
|
|
|
|
Ya steve,
i got it k an provided with new ids..
thank u..
Gita
|
|
|
|
|
Hi,
I developing an application which hooks a Common dialog. i used CDM_GETFILEPATH to get the full path from Save dialog. But when there is not file extension is specified with the file name, the CDM_GETFILEPATH return's the full file path without any file extension.i thought If an extension is not given with the file name the default extension is concated with the file name. But this is not happing and CDM_GETFILEPATH give like this "C:\MyFolder\new" and not full path "C:\MyFolder\new.txt". Why?? . And is there any way to get the default file extension from a Common Dilaog using any Mesages and if so Which is that message?.
thanks
Nitheesh
|
|
|
|
|
Nitheesh George wrote: thought If an extension is not given with the file name the default extension is concated with the file name
only if you set lpstrDefExt of OPENFILENAME to some value, if it is NULL common dialog won't add the default extension. you can also change the default extension using CDM_SETDEFEXT message.
|
|
|
|
|
Hi All,
Help me out, it’s very urgent. Do and Die condition.
How to Run UNIX based EXE [MKS] through Shell in VC++ application.
Intermediate Shell should not be seen (It can be hide); target application should rum through SHELL.
And Target Application status should be returned whether target application run or not.
Example:
Intermediate Shell- Target Application
SHELL.exe à Target.exe
If any error occurs while running Target Application, return that status to application.
I am doing through _spawnl() API.
Int lnSts =_spawnl(_P_NOWAIT,”SHELL_PATH.exe”,”SHELL_PATH.exe”,”-Lc Target.EXE”,NULL);
But in this case if my target application having any problem like Target EXE has Segmentation Error. _spawnl will not return Target Application Fail Error.
It return intermediate SHELL execution status.
Is there any VC++ API, which executes any process through shell and returns its status?
Please help us. Any suggestion most welcome.
|
|
|
|
|
ShellExecute[^] (different than unix shell) is probably better than _spawn
What are the arguments or parameters that "SHELL.exe" can have ? can you pass it an executable path (filename) ?
Could you auto-generate a shell script to run your "Target.exe" that can be automatically be called by one of the dot file (.cshrc .tcshrc .login, ... ) ?
Other than that, I'm afraid your on your own.
|
|
|
|
|
Hi All,
Help me out, it’s very urgent. Do and Die condition.
How to Run UNIX based EXE [MKS] through Shell in VC++ application.
Intermediate Shell should not be seen (It can be hide); target application should rum through SHELL.
And Target Application status should be returned whether target application run or not.
Example:
Intermediate Shell- Target Application
SHELL.exe à Target.exe
If any error occurs while running Target Application, return that status to application.
I am doing through _spawnl() API.
Int lnSts =_spawnl(_P_NOWAIT,”SHELL_PATH.exe”,”SHELL_PATH.exe”,”-Lc Target.EXE”,NULL);
But in this case if my target application having any problem like Target EXE has Segmentation Error. _spawnl will not return Target Application Fail Error.
It return intermediate SHELL execution status.
Is there any VC++ API, which executes any process through shell and returns its status?
Please help us. Any suggestion most welcome.
|
|
|
|
|
kulkarniquiet wrote:
Is there any VC++ API, which executes any process through shell and returns its status?
Have you see this?
"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
|
|
|
|
|
Thanks for reply. I have already seen that.
|
|
|
|
|
So have you tried the suggestions?
"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
|
|
|
|
|
Yes,but till now no output.
I am searching more on this.
Thinking on terms of http://en.wikipedia.org/wiki/Spawn_(operating_system)
I am also thinking for
1. Call GetLasterror if any error occurs.
2. Using child PID, we can get ThreadContext using SetThreadContext API.
3. In this way, we can get error that is occurred in child process using _spawnl.
Need to explore more this method.
Any suggetions?
|
|
|
|
|
kulkarniquiet wrote: Any suggetions?
Does SHELL_PATH.exe open a console window?
"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
|
|
|
|
|
Using the resource editor, I set up a menu item to call a function in a message map in a CListView class, but the menu item is greyed out and does nothing when clicked at runtime. The menu item is enabled and I added an event handler. I'm using the document/view architecture, but want to use a CListView to display a list of class objects derived from CObject, not part of the document. As far as I can tell, the message maps are all appropriate, the function to create and display the listview looks ok and the project compiles, links and runs without errors, just the menu item does nothing when clicked and the listview isn't displayed. I'm a beginner with C++/MFC and there's probably something simple I'm overlooking. Anyone have any suggestions? I can include code, but not sure what code to send. Thanks.
|
|
|
|
|
I'm using Visual C++ 6.0 on windows XP. (I'm new to C++/MFC) I want to write code that uses a spin control to increment a floating point value by some delta. When I add a spin control to my dialog window, in the class wizard I get only two choices when the IDC_SPIN (name ID I gave the spin object) is selected in Class Wizard message map - either UDN_DELTAPOS as a message or NM_OUTOFMEMORY message. If I tell class wizard to implement a function with UDN_DELTAPOS message, I get the code generated by the wizard as:
void CEditsDlg::OnDeltaposSpin1(NMHDR* pNMHDR, LRESULT* pResult)
{
NM_UPDOWN* pNMUpDown = (NM_UPDOWN*)pNMHDR;
// TODO: Add your control notification handler code here
*pResult = 0;
}
That code is called each time the mouse is pressed while on the arrow, but I can't tell whether the up arrow or the down arrow is pressed. So if I use that routine, I don't know whether to increment or decrement a value like I want to.
All I want to do is when someone puts the mouse on the up arrow of the spin control in the dialog window, I want to increment a value. And if they put the mouse on the down arrow of the spin control, it decrements the value. I don't see how to code this.
Thanks ahead of time.
|
|
|
|
|
Kwanalouie wrote: That code is called each time the mouse is pressed while on the arrow, but I can't tell whether the up arrow or the down arrow is pressed. So if I use that routine, I don't know whether to increment or decrement a value like I want to.
The iDelta member of the NMUPDOWN is a signed value - positive for the up, negative for the down.
|
|
|
|
|
From MSDN:
pNMHDR is a long pointer to an NMUPDOWN structure that contains information about the position change.
The iPos member of this structure contains the current position of the control. The iDelta member of the structure is a signed integer that contains the proposed change in position. If the user has clicked the up button, this is a positive value. If the user has clicked the down button, this is a negative value.
"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
|
|
|
|