|
@largeinsd wrote: ...it gets activated on initialization.
The solution to this is to differentiate between initialization and the actual clicking of one of the buttons. I use a bool member variable to denote this.
"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
|
|
|
|
|
Also, don't you need a Group Box for the radio buttons to act properly? Is that not true David?
John P.
|
|
|
|
|
jparken wrote: Also, don't you need a Group Box for the radio buttons to act properly? Is that not true David?
Ok, interesting point. For what it's worth I do have the radio buttons enclosed in a group box. If there is some particular initialization required, please let me know.
-Jason
|
|
|
|
|
jparken wrote: Also, don't you need a Group Box for the radio buttons to act properly? Is that not true David?
No, a group control (i.e., a control having the BS_GROUPBOX style) is not necessary. Perhaps you are confusing that with the first radio button of the group having the WS_GROUP style and all others in the group not.
"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
|
|
|
|
|
I am trying to programatically create an empty file in a location such as
C:\Program Files\Common Files\myCo\MyTool\Temp.dat
However using the CFile member , I get a failure with code = 3
Is it not possible to create a file where the upper directories have not been created ?
This is the code I am using
<br />
<br />
CFile f;<br />
CFileException e;<br />
<br />
if( !f.Open( m_strFileName, CFile::modeCreate , &e ) )<br />
{<br />
#ifdef _DEBUG<br />
afxDump << "File could not be opened " << e.m_cause << "\n";<br />
#endif <br />
}<br />
else<br />
{<br />
<br />
<br />
}<br />
Help is apprecaite d!
|
|
|
|
|
act_x wrote: Is it not possible to create a file where the upper directories have not been created ?
no
|
|
|
|
|
You might make use of this function.
<br />
bool MakeSureDirectoryPathExists(PCSTR strPath);<br />
It helps when you are unsure of whether the entire path exists or not before you open a file.
Chris Meech
I am Canadian. [heard in a local bar]
|
|
|
|
|
Call SHCreateDirectoryEx() before creating the file.
"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
|
|
|
|
|
On a dialog based application I have attached an OpenGL window which is overlaid on a static control. When the user does a left mouse button down followed by a left mouse button up on the opengl window I want an event to occur. However i have the following constraints:
If the user leaves the area of the opengl window and release the left mouse button i don't want the event to happen
If they then press the left mouse button down outside of the opengl model and then release it whilst in the opengl window i don't want the event to happen.
However if they press the left mouse button inside the opengl window, then leave the opengl window but then come back into it and then release the mouse button the event should happen
I've tried using the left button down event on the main dialog however if the user clicks (down or up) on any of the other buttons on the dialog then the main dialog doesn't handle the event.
Does anyone know how to handle this set of events (or even what I'm talking about? )?
TIA,
Andy
|
|
|
|
|
This is an MFC example, but if you're using straight APIs you can do the same.
::MessageBeep() should get called on the left button up message according
to your requirements (unless I need more caffeine)...
void CMyWindow::OnLButtonDown(UINT nFlags, CPoint point)
{
CWnd::OnLButtonDown(nFlags, point);
SetCapture();
fInCapture = true;
}
void CMyWindow::OnLButtonUp(UINT nFlags, CPoint point)
{
if (fInCapture)
{
ReleaseCapture();
fInCapture = false;
CRect clirect;
GetClientRect(&clirect);
if (PtInRect(&clirect, point))
{
::MessageBeep(-1);
}
}
CWnd::OnLButtonUp(nFlags, point);
} Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
cheers Mark, worked a treat
|
|
|
|
|
Hello,
I have a class derived from CMDIChildWnd .In one of the functions I have written
CMenu p;
GetParentFrame()->SetMenu(&p);
But the menu doesn't change.
What else I need to do to change the menu?
Regards
Prithaa
|
|
|
|
|
You're missing DrawMenuBar .
Iain.
|
|
|
|
|
hot to assign a tooltip to a push button in c++
plz help
dghdfghdfghdfghdgh
|
|
|
|
|
|
LMAO
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
|
I create subclass that derive from CEdit and on my dialog have 2 Edit control that including two DDX variable of this class.
I need to use OnEraseBkgnd funtion for change the color of each edit control.
Can I separate the code for change different color in this function.
|
|
|
|
|
It would be better to handle the WM_CTLCOLOR message each edit send the dialog box. There;s an explanation of this method most days on here, so I'm not going to give you detail.
But one of the parameters will identify the ID of the edit control, or the HWND - and you can get the ID from that.
Then simply return different colours.
Iain.
|
|
|
|
|
I use Visual studio C++.NET 2005.
Now I can execute the facedetect.c.
But I need to cut the photo which I detected.
Does anybody know how to write this function's code?
Please give me some example code to reference.
Thank you very much.
|
|
|
|
|
Hi,
I am developing a SDI app. I have disabled the System menu (Windows menu) and I display my own popup menu when the user clicks on the Icon on the title bar.
But when the App is minimizid, when the user clicks on the App in the taskbar, my custom menu doesn't show up.
Is there any way of popping up my own menu when the user clicks on the minimized app?
Thanks in advance,
Narahari Upadhya
|
|
|
|
|
How are you getting your menu to pop up? It sounds as if you're using WM_NCLBUTTONxxx, and I guess when it's in the task bar you don't get this kind of message - am I close?
If this is correct, consider using GetSystemMenu(FALSE) and *modifying* that menu to be what you want. I would suggest that it's 'controversial' to meddle with the standard user interface if you can find other ways to achieve your goal. It may be a simple case of disabling all standard items and adding your items to the end...
|
|
|
|
|
Thats right. I am handling WM_NCLBUTTONXXX to popup my menu.
The reason I don't want to use system menu at all is that I want to remove the default close, minimize and maximize buttons and add my own custom buttons there and hence I have to remove the system menu and show my own menu rather than modifying the system menu.
|
|
|
|
|
I tried manipulating the system menu to add my own menu items.. it works perfectly fine except that eventhough I have Removed the system minimize, maximize and close buttons and drawing my own buttons on top of them, Whenever I click on the title bar, the system close box appears everytime.
I heard its a XP related issue.
Is there any way of getting rid of the close button?
Thanks,
Narahari Upadhya
|
|
|
|
|
Hello everybody,
after resolving a strange error ( error during message queue by setting a pointer )
i put the char *BufferString from a lower place more higher :
from
class MyCEdit
{
public:
MyCEdit(.....);
ccc vvv;
bbb nnn;
protectec:
MessageLoop(.....)
public:
char *Bufferstring; <<<<<<<<
hhhh jjjj;
protected:
oooo pppp;
rrrrr tttt;
};
to
class MyCEdit
{
public:
MyCEdit(.....);
char *Bufferstring; <<<<<<<<<
ccc vvv;
bbb nnn;
protectec:
MessageLoop(.....)
public:
hhhh jjjj;
protected:
oooo pppp;
rrrrr tttt;
};
Now it works
Is it possible that more than one declaration of public or protected blocks makes
internal errors?
I'm really confused, because 6-7 months ago i had a similar problem and i "resolved" it the same way...
|
|
|
|