|
Suppose i have a string like
CString csPath = "c:\\windows\\test.exe -parm1"
or
CString csPath = "c:\\windows\\test.exe /parm1"
now to test whether test.exe exists or not
i can't just use csPath and call GetFileAttributes that will fail because of the commandline arguments
i will have to extract the application path from the full command line which will be tedious(the examples above are easy but there are more complex ones like:
C:\WINDOWS\ISUNINST.EXE -f"C:\Program Files\Adobe\Photoshop 5.5\Uninst.isu" -c"C:\Program Files\Adobe\Photoshop 5.5\Uninst.dll" )
any help suggestions are welcome
C makes it easy to shoot yourself in the foot; C++ makes it harder, but when you do, it blows away your whole leg
http://www.mastishk.com
|
|
|
|
|
PathRemoveArgs() should help
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Why not use:
TCHAR szDrive[_MAX_DRIVE];
TCHAR szDir[_MAX_DIR];
TCHAR szFname[_MAX_FNAME];
TCHAR szExt[_MAX_EXT];
::_tsplitpath(csPath, szDrive, szDir, szFname, szExt);
Then, just check to see if you have the filename and extension in szFname and szExt.
|
|
|
|
|
if i want to access value of the textboxes in previous dialog (for both modal and modeless) into the new dialog
veda
|
|
|
|
|
use SendMessage with ur parameters as wparam/lparam.
rgds..mil10.
|
|
|
|
|
thanks first,,
what mean CFileException::accessDenied (m_cause is 5 ) ?
msdn just says "The file could not be accessed."
|
|
|
|
|
That's what it means. It means the file is not there, or you can't do what you were trying to do to it ( for example, open a file for writing if it's on a CD, or is read only )
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Is it possible to inspect or print out either the typeid of a pointer to a c++ class, or the actual value typecast e.g. if I have 'class parent {}' and 'class child : public parent {}', and in the routine I want to debug I have a 'parent*' that I'm pretty sure is actually of type 'child', is there a way I can bring that up? I've tried the command window, in both command mode and immediate mode, but I can't figure out the right syntax to use.
|
|
|
|
|
Looks like the RTTI to me.
To print out, check codes below (from MSDN)
Makesure, you have your project RTTI enabled.
// expre_typeid_Operator.cpp
// compile with: /GR /EHsc
#include <iostream>
#include <typeinfo.h>
class Base {
public:
virtual void vvfunc() {}
};
class Derived : public Base {};
using namespace std;
int main()
{
Derived* pd = new Derived;
Base* pb = pd;
cout << typeid( pb ).name() << endl; //prints "class Base *"
cout << typeid( *pb ).name() << endl; //prints "class Derived"
cout << typeid( pd ).name() << endl; //prints "class Derived *"
cout << typeid( *pd ).name() << endl; //prints "class Derived"
delete pd;
}
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
In my multithreaded dialog-based app, I'm popping up two modal dialogs at the same time (in seperate ON_FOO_MSG handlers). When one closes, I'd like focus to return to the other, but right now it returns to the main dialog instead. Calling SetActiveWindow() or SetFocus() or SetForegroundWindow() on the remaining dialog brings it to the foreground, but the dialog still won't accept any keyboard input (somehow, ESC still closes it, though).
-KB
|
|
|
|
|
This is not a good design. Only one thread should be controlling the user interface.
In MFC, only one window can be inside a modal loop at any time. As soon as the dialog closes, modality returns to the dialog that was previously modal. There's nothing you can do about it without closing your main dialog. If you want to go from one to the other, you'll have to show the first one (and not the second one), and then show the second one when the first one closes.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I know it's not good design, but it's legacy code that I've got to work with.
Lets say that dialog A spawns dialog B and dialog C. If dialog C closes, keyboard commands seem to route back to dialog A (C's parent). Is there a way to route them to B instead?
|
|
|
|
|
kbratvold wrote:
Is there a way to route them to B instead?
Not that I know of.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I have a problem with MFC, I am building this application, and I am using the MFC wizzard to add message handlers for my menus, everytime I give a particular menu a name, say, SERVER now I add to the first empty item in the SERVER menu item called
ID_SERVER_MOUNT_SERVER
followed by
ID_SERVER_DISMOUNT_SERVER,
for some reason the the wizzard is assigning them both the same ID causing problems when I come to add the message handlers. If I go back and correct the problem, and re-compile, it still will not fix the problem, which apart for causing me to loose my hair, won't work when it comes to using
COMMAND and UPDATE_COMMAND_UI
Short from starting the whole project over, I don't have a clue why this problem exist, and solutions??
|
|
|
|
|
Best bet - learn not to use the wizards. They always screw things up.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Hi,
These header files are 'included ' (along with several others) in a C++ program i received. however, they are not on my system, and when i start the compiler, it cannot find them:
#include sys/time.h
#include termios.h
#include unistd.h
Are these standard files? Where can I find them?
Thanks
Michael
oops!
|
|
|
|
|
MichaelGG wrote:
Are these standard files?
On a UNIX system they are
MichaelGG wrote:
Where can I find them?
On a UNIX system, but the chances are the application won't work under Windows if it relies on anything in them.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
As the other guy said, they are standard for Unix.
You have two choices under windows: the better one is to figure out what parts of those are used, and then design a windows alternative. If this is open source and you do this, please submit the changes back.
The easier one (and perhaps just as good) is to install either Cygwin or mingw and use them to compile it, as they already have both most of what you need. You may still need to do some porting to make the programs work it won't be nearly as much work. I have no comments on which is better.
|
|
|
|
|
how can i access the parallel port input and output
|
|
|
|
|
Depends what you want to do. It's probable that there is an article here on CP that will answer your question, I know there's lots of articles, because I've been reading them.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Hello,
I have already communicate with a lot of experts and read a lot about my
problem which is as follows: I want to develop a generic program for a
PocketPC, which logs the method-call and the time when any button or anything
else is executed, respectively a method is executed, in a file on the Pocket
PC. I need this for Usability studies. Every experts told me that i can reach
this only with embedded c++ or c code. I wrote my previous programs always with
c#.
So i want to ask in this forum if somebody can help me to solve my problem?
- this would be very important for me, because i need it for my diploma
(thesis).
thanks in advance.
Regards.
Patrick
|
|
|
|
|
You want a system wide hook, which is probably a C++ thing. There are plenty of examples on the web, find one, wrap it in COM and interop it to C#.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
I'm working on an application that will use a custom input device, supplied by the client, which connects to the parallel port. They've given me a disagram which looks like this
25 Status 0 1 2 3
11 S7 ML H Men LF
15 S3 LB A/T PB A>>Z
13 S4 Z<
|
|
|
|
|
I'm creating a file from the binary data stored in an image field in a database. When the user clicks on the filename in my listbox, I read the bytes from the database, and create the file, then do a shellexecute() to open the file. All this works fine, except I use GetModuleFileName to create a path to a folder called 'temp' in the same directory as the exe. If the 'temp' folder doesn't already exist, my app crashes, but if the folder already exists, everything is fine. Any help would be appreciated.
I thought by specifying CFile::modeCreate as one of the flags it would create the directory as well as the file. Apparently not.
[insert witty comment here]
bdiamond
|
|
|
|
|
How about:
if (_access(..., 0) == 0)
CreateDirectory(...);
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|