|
Hmmm. sounds tricky;P
...::: knowledge is king :::...
|
|
|
|
|
I have a CEdit derived class. I wanted to override the OnChar messages and PreTranslateMessage. However, when I add these I get "member function not declared in CDerivedEdit" errors. I have checked that the correct entry is in the header file and the mapping macro in the implementation file. Am I doing something else wrong or is something weird somewhere?!
thanks in advance
|
|
|
|
|
I've been trying to close another application from within my application I've used EnumWindows to obtain the handle of the other application. The problem is If The Other Application Remains Active WM_CLOSE message works fine but if it is not active there goes the problem I'm unable to activate it and the Other Application remains without closing . Does anyone knows how to come over this?
Thanks in advance
P Vijaya Rama Raju
|
|
|
|
|
Try sending WM_QUIT to the UI Thread.
--------------------------------------------------
If my messages appear curt, I apologize.
I try to be brief to save your time as well as mine.
--------------------------------------------------
|
|
|
|
|
Can you write code ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Have you tried TerminateProcess() ?
Here is a sample:
int KillPid(DWORD pid) {
HANDLE hPid = OpenProcess(0, FALSE, pid);
if (hPid != NULL) {
if (TerminateProcess(hPid, 0) == TRUE) {
CloseHandle(hPid);
return 0;
} else {
CloseHandle(hPid);
return GetLastError();
}
CloseHandle(hPid);
}
return 1;
}<pre>
|
|
|
|
|
Thanks, it is useful example ...
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Some people say I can, most say I can't
Try:
http://www.codeproject.com/threads/interprocesssync.asp
--------------------------------------------------
If my messages appear curt, I apologize.
I try to be brief to save your time as well as mine.
--------------------------------------------------
|
|
|
|
|
can you point me the difference beetween:
Option m_Option;
m_Option.DoModal();
and:
m_Option = new Option(this);
m_Option->DoModal();
Both work but what is the difference "new" create a new instance ?
but if I "new" something I assume I should delete it somewhere ?
I'm a bit lost here while MFC do so much things automaticly
I don't want to miss something and to get memory leak.
Thanks
|
|
|
|
|
The difference is that m_Option is obviously a member variable to a pointer, Option is just an istance of the dialog. You never call delete on a CWnd, you call DestroyWindow, which ( I believe ) will be called for you in the case of a modal dialog. You should definately set m_Option to NULL after the DoModal though, and also in your constructor, for safety.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
In your option 's ::PostNcDestroy()
add :
delete this;
no memory leak;
|
|
|
|
|
Thanks
|
|
|
|
|
I hope somebody can help me with this (before I tear all my hair out and/or reformat my disk and reinstall everything)
For the last week or so, every now and then, as I am working in Visual Studio, I get a dialog labelled "MSDEV.EXE - No Disk", with the message "There is no disk in the drive. Please insert a disk into drive \Device\Harddisk1\DR2.". Three buttons, labelled "Ok", "Cancel" and "Try Again" each seem to do nothing, I need to terminate Visual Studio via the Task Manager to clear the message. Sometimes there is a considerable time (Hours) between stating Visual Studio and when this happens, other times it may only be a few minutes. I have uninstalled and reinstalled Visual Studio to no avail. I would suspect the hardware, except that no other application is failing in any way! BTW, I am running Windows 2000 Professional, on a new computer. I never had a problem like this on my previous machine.
Regards,
Gunter
Gunter F. Maywald
CSIRO Entomology
Long Pocket Labs, Brisbane
Australia
|
|
|
|
|
In Tools -> Options, you can go to the Directories tab and see where it's looking for things. If there are duplicate paths that don't exist anymore then you can just delete them from there and you'll have no problem anymore.
|
|
|
|
|
Hi,
I have two variables with types CString and int.
int nWidth;
CString strWidth;
strWidth = "110";
How do I convert strWidth("110") to int type(110) so I can store it in nWidth?
Please show me how to do this, thank you very much.
|
|
|
|
|
use the atoi or atol functions.
iWidth = atoi(strWidth);
|
|
|
|
|
Or you could use strtod() and strtol().
strtol() is useful if you want to read a number that is not in base 10. For example
to read hex numbers use strtol("0x12345678", NULL, 16)
_tcstol() and _tcstod() are the macros for UNICODE/MBCS portability
Stephen Kellett
--
C++/Java/Win NT/Unix variants
Memory leaks/corruptions/performance/system problems. UK based.
Problems with RSI/WRULD? Contact me for advice.
|
|
|
|
|
int nWidth = 110; <br />
CString strWidth; <br />
strWidth.Format ( "%d", nWidth );
-Ben
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|
Use function StrToInt this way
int nWidth=StrToInt(strWidth);
just one line of code and u got inr value.;)
Gonna be 18 till I die
|
|
|
|
|
Two problems. First, why use a non standard function when atoi works perfectly well, and second ( from MSDN)
Windows NT/2000: Requires Windows 2000 (or Windows NT 4.0 with Internet Explorer 4.0 or later).
Windows 95/98: Requires Windows 98 (or Windows 95 with Internet Explorer 4.0 or later).
Sounds like a bad idea to me, unless you specifically do not target the platforms not supported, and even then I would personally prefer not to get into the habit of using something I may find unavailable to me down the track, for no good reason I can see.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
I need to color 3D graphic object, the graphic object is described by multiple triangles in variable size. I need to color this 3D object. Color will be variable based on the different
heighth (Z coordinate) of the 3D dimension, but the parts which are in the same height must be in the same color. How to color this graphic object? Please help me.
|
|
|
|
|
Since you can set a color for each vertex of the mesh, this doesn't seem to be a problem. Just set the color as a function of the z for each vertex :
...
glColor3f(R(z),G(z),B(z));
glVertex(x,y,z);
...
where R,G,B are mapping of z
Jonathan de Halleux, Belgium.
|
|
|
|
|
I am currently writing a Dialog based application that sits atop a database. In the summary screens I use a ListCtrl to display all records from a given table that can be selected to then take us to the detail screen. Using advice previously administered from this forum I have set the width of column one to zero, this is to hide the tables Primary Key from the user, while still having it available to me to use when next accessing the record in the database.
In a particular table I have an Order column for use in reports that the user, uses to set the order. I want to create a seperate screen where the user can reorder the records. This is where I have run into my current problem, how do I achieve this what is the best control for me to use.
I envisaged using the ListCtrl, which has become my friend in this project. I would display the Customer (with hidden Primary Key), allow them to re-order the list and then I would cycle through the records updating them sequentially with the new order value.
Problem is the SetItemPosition() function only works when in Icon or Small Icon mode and SetExtendedStyles only has drag and drop ability on rows not columns. Of course I am using Report mode and need to re-order the rows not columns. This stops me from using drag and drop or Up/Down command buttons to enable the re-ordering.
I also thought about using a ListView, but if I didn't want to have the Primary Key visible I would have to create a map and store it in an array external to the ListView. This would force me to keep track of the order of two things to achieve the result I want. Thats one to many for my brain that is running low on RAM at the moment.
What have I missed? I'm sure it is obvious, but not to me. How should I be doing this? Preferably I would like to be able drag the row into it's new position. Any help much appreciated. What's the answer?
Thanks in advance for the help.
P.S. All humour, sarcasm and colloquialisms removed so as not to confuse or offend. Also as a test to see if this question gets an answer this time.
Michael Martin
Pegasystems Pty Ltd
Australia
martm@pegasystems.com
+61 413-004-018
|
|
|
|
|
The only built-in control that does drag & drop of rows is CDragListBox, but that's derived from a listbox (old Win 3.1 control) not a list view control, so if you need to keep the report style UI of the list view control, CDragListBox won't do it for you.
The list view control doesn't have any built-in reordering support, unfortunately. (Well, version 6 of the common controls does, but that only works on XP.)
--Mike--
http://home.inreach.com/mdunn/
"Holding the away team at bay with a non-functioning phaser was an act of unmitigated gall. I admire gall."
-- Lt. Cmdr. Worf
|
|
|
|
|
Mike
thanks for the help CDragListBox seems to be what I was looking for. MSDN says that I can have columns and set their width so I should be able to keep the Primary Key in the row data which is what I was looking for. It also tells me that I just add a ListBox to my dialog in the editor and then in ClassWizard set a control variable of type CDragListBox. Problem is that I only have CListBox as a choice. I am going to add CListBox and then manual edit the code to use CDragListBox and hope that this works.
Any idea why these other choices aren't appearing? Is it a setting I can modify or maybe a header I am missing in the project?
I have noticed other strange things that have hapened over time. A couple of years ago when I would create an app with a DropList ComboBox I would have the option of selecting a CString as a value variable, while now I only get int. I then have to change the int to CString and hack the DDX section of the code to get it to return the selected string and not zero based index when I do UpdateData(TRUE);
Did these changes appear while I was sleeping for the past couple of years or have I just screwed up something simple yet again?
Michael Martin
Pegasystems Pty Ltd
Australia
martm@pegasystems.com
+61 413-004-018
|
|
|
|