|
Is there an MFC function to terminate an application? (like AfxAbort(), but without the ugly error message)
[insert witty comment here]
bdiamond
|
|
|
|
|
This line causes terminate the application:
::AfxGetApp()->ExitInstance();
Ivan Cachicatari
www.latindevelopers.com
|
|
|
|
|
I just ended up calling my CMainFrame class's OnClose() function, since that's where I'm at when I need to do it anyway, and it works fine. I tried ExitInstance first, and it didn't work right. thanks, though!!
[insert witty comment here]
bdiamond
|
|
|
|
|
Mmmm...
In that case your question will be: "Howto close correctly the main frame window in a MFC application?"
Ivan Cachicatari
www.latindevelopers.com
|
|
|
|
|
Yeah, maybe I did go about asking the question the wrong way. But I got it now. Thanks
[insert witty comment here]
bdiamond
|
|
|
|
|
The prefered method is to post a WM_CLOSE message. This is what happens when you close an application via Alt+F4, or by selecting Exit from the File menu. Note that this is not the same as calling PostQuitMessage() .
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
After installing the latest DX9 SDK, the DirectX panel is gone.
I wonder if it is normal? If so, how do I switch between retail
and debug?
When I use Dxdiag, the program reports that "d3dref.dll" "d3dref8.dll" and "d3dref9.dll" are Final Debug.
I wonder if it is normal?
-----------------------------
C++ without virtual functions is not OO. Programming with classes but without dynamic binding is called "object based", but not "object oriented".
|
|
|
|
|
Dunno about normality. What even is the DirectX panel ? You mean a Control Panel applet ? I have never even had one on my computer..
I have DirectX 9.0b run-time, and the latest DirectX 9 SDK installed. The files you mentioned are marked as "Final Debug" for me also. However my DirectX games and applications work flawlessly, so I must presume that there's nothing wrong.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Hi,
I have a list control with the default multiple selection style.
The problem is that if I drag the mouse over it, it will not select all the itmes, like we do for example in a CListBox class.
If I want to select multiple items, I have to use SHIFT+ Arrow key.
How do I enable the mouse doing it
Shay
|
|
|
|
|
To enable select multiple items using the SHIFT key and the mouse or special key combinations, create the control with LBS_EXTENDEDSEL style, or set this style with.
m_yourListCtrl.ModifyStyle(0,LBS_EXTENDEDSEL);
Ivan Cachicatari
www.latindevelopers.com
|
|
|
|
|
The problem is that :LBS_EXTENDEDSEL is for a list box.
Is there anything for CListCtrl or CListView ?
|
|
|
|
|
Yes,
To modify this style in a CListView use:
CListCtrl& theCtrl = GetListCtrl();
theCtrl.ModifyStyle(0,LBS_EXTENDEDSEL);
or inicialize this ina PrecreateWindow function.
BOOL CYourOwnListView::PreCreateWindow(CREATESTRUCT& cs)
{
cs.style |= LBS_EXTENDEDSEL;
return CYourOwnListView::PreCreateWindow(cs);
}
Ivan Cachicatari
www.latindevelopers.com
|
|
|
|
|
just wondering, is there a better thing than strtok ( and related ) ?
I need to be able to count the number of delimiters as well as tokens; not really count but scan for them. if one one my delimiter is the space, I want to know that if I have 2 spaces, I will get an empty token between them.
for example, if my delimiter is ; and I have the following string :
text;text;;text;text
I wil get something like :
text
;
text
;
;
text
;
text
I could make my own version of it, but if such a thing exists, I'd be glad to use it.
I've just learned about the boot::char_separator which would do what I like, can I use only a subset of boost ?
Thanks.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
you can just do it manually
for (
int i=1;
i<=strlen(youstring)-1;
i++
)
{
if (yourstring[i]==';')
int tokcount++;
if ((yourstring[i]==';')&&(yourstring[i+1]==';'))
int sepcount++;
}
try and tell me if this is what you want.
gabby
|
|
|
|
|
I decided that I neeeded to make my own ...
Thanks.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
I want to create an array of variable addresses (different types).
e.g.
void * addressArray[20]; // Is void pointer correct?
unsigned status : 4;
short data1;
long data2;
float data3;
double data4;
<br />
addressArray[0] = &status;<br />
addressArray[1] = &data1;<br />
addressArray[2] = &data2;<br />
<br />
<br />
CString formatStr;<br />
<br />
formatStr.Format("Data 1 = %d", *data1);
printf(formatStr); Is this possible, I have heard of a type called variant but never used it.
|
|
|
|
|
|
Thanks for your post. I have spent the day trying the new OleVariant and VARIANT types.
I found that the example project did not do what I required, so I opted for the VARIANT, but have a problem. When I display the data is is always a funny value and when I set it to to 0, then it always remains at 0. I have just concentrated on dealing with a unsigned short at present; but will want to deal with floats, doubles etc later
See code below:-
VARIANT varData[5];<br />
<br />
union<br />
{<br />
unsigned short mess_13_tp1_w01_data1; <br />
unsigned short mess_13_tp1_w03_data2; <br />
unsigned short mess_13_tp1_w02_data_X; <br />
unsigned short mess_13_tp1_w02_data1_X; <br />
unsigned short mess_13_tp1_w02_data2_X; <br />
unsigned short buffer[32];<br />
}mess_13_m_tp1_display;<br />
<br />
<br />
VariantInit(&varData[0]);<br />
varData[0].vt = VT_UI2;<br />
varData[0].puiVal = &mess_13_m_tp1_display.mess_13_tp1_w01_data1;<br />
VariantInit(&varData[1]);<br />
varData[1].vt = VT_UI2;<br />
varData[1].puiVal = &mess_13_m_tp1_display.mess_13_tp1_w02_data_X;<br />
VariantInit(&varData[2]);<br />
.<br />
.<br />
Etc<br />
<br />
for( j = 0; j < message.getNoFields(); j++)<br />
{<br />
m_cSignalList.SetItemText(j , 0, message.details[j].fieldDesc);<br />
m_cSignalList.SetItemText(j , 1, message.details[j].signal);<br />
formatStr.Format(message.details[j].display1,&message.varData[j].uiVal);<br />
m_cSignalList.SetItemText(j, 2, formatStr); formatStr.Format(message.details[j].display2,message.varData[j].uiVal);<br />
m_cSignalList.SetItemText(j, 3, formatStr);<br />
m_cSignalList.SetItemText(j , 4, message.details[j].unitsStr );<br />
}
I use a ListCtrl to display and modify the data, hence the need to use VARIANTS.
Any suggestions to overcome this problem?
grahamfff
|
|
|
|
|
Hello,
I want to save a file in my exe project and
use it (Read and Write),
this file is in my exe file not
in any folder!
Best Wishes,
Thanks.
|
|
|
|
|
Use the CFile class...
Regards
Carlos Antollini
Do you know piFive[^] ?
|
|
|
|
|
Zero_One_ADO wrote:
this file is in my exe file not
Meaning that it is in the exe's resource table? If so, are you wanting to extract the resource and save it to a separate file?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
save them as resources.
gabby
|
|
|
|
|
Hello,
I have an Owner-Drawn Button.
I want to change the cursor when my
Mouse is Over the Button,
Best Wishes,
Thanks.
|
|
|
|
|
Process the WM_SETCURSOR message.
BOOL CMyView::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
switch(pWnd->GetDlgCtrlID())
{
case IDC_BUTTON_1:
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_IBEAM));
or
SetCursor(AfxGetApp()->LoadCursor(IDC_MY_CURSOR));
return TRUE;
break;
case IDC_BUTTON_2:
SetCursor(AfxGetApp()->LoadStandardCursor(IDC_CROSS));
return TRUE;
break;
}
return CFormView::OnSetCursor(pWnd, nHitTest, message);
}
|
|
|
|
|
I'm porting code written in C++ for a Motorola ColdFire chip to Visual C++.
In the original program I have two files which I will call Code.cpp and Code.h
Code.h has the class and member function declarations and Code.cpp has member function definitions and the operative code.
The main class for the program is, let's say, cMain, which has a bunch of nested classes.
Now in my Code.cpp file, after the declarations of the constants, I had the following line
extern cMain Main;
In Visual C++ (VS2003) this throws an LNK2001 error. If I remove the extern the program compiles without error.
Could somebody please explain why this is so? When should an object be instantiated using "extern" in VC++ (VS2003)?
Thanks!
|
|
|
|