|
By the way, how did you notice that the files were hidden
"After all it's just text at the end of the day. - Colin Davies
"For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus
|
|
|
|
|
john_tran wrote:
What techonology of this i need to learn to do it by myself?
How about SetFileAttributes() ?
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hi
I wan't to run my exe program and pass some arguments with the exe file. example:
MyProgram.exe "nr1,nr2,nr3,nr4,nr5"
This is some of the code:
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
char *token;
char seps[] = ",";
token = strtok( lpCmdLine, seps );
This works ok in Visual C++, but i would like to do this in Emededd C++. There i get an error: error C2664: 'strtok' : cannot convert parameter 1 from 'unsigned short *' to 'char *'
How can I do this right?
Thanks!
|
|
|
|
|
try casting your lpCmdLine var to char*
strtok( (char*)lpCmdLine, seps );
It seems strange, cuz LPSTR is an ANSI string...
Hope this helps you,
Davy
|
|
|
|
|
|
GDavy wrote:
It seems strange, cuz LPSTR is an ANSI string...
Not if you are compiling for unicode, then LPSTR is unsigned short * .
"After all it's just text at the end of the day. - Colin Davies
"For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus
|
|
|
|
|
Nono,
LPTSTR is a Unicode format (wide char) in UNICODE and ANSI when not compiling for UNICODE
LPSTR is always ANSI string (8bit)
LPWSTR is always wide char string(16 bit)
But I used to be confused by these too..
Greetz,
Davy
|
|
|
|
|
You're so right.
But regardless, it seems that something makes his compiler believe that LPSTR is defined as unsigned short * .
"After all it's just text at the end of the day. - Colin Davies
"For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus
|
|
|
|
|
gunnar66 wrote:
error C2664: 'strtok' : cannot convert parameter 1 from 'unsigned short *' to 'char *'
It seems like you've defined UNICODE (or _UNICODE, I can't remember the definition for compiling for unicode precisely). If thats the case, then LPSTR translates to unsigned short * instead of char * .
strtok requires char * parameters, if you intended to use unicode strings, you should use wcstok instead.
[EDIT]A GDavy has corrected me, LPSTR should be defined as CHAR * and CHAR should again be defined as char . But if the code you've given us is the same you're using for your embedded version, then somehow LPSTR must be defined as unsigned short * [/EDIT]
"After all it's just text at the end of the day. - Colin Davies
"For example, when a VB programmer comes to my house, they may say 'does your pool need cleaning, sir ?' " - Christian Graus
|
|
|
|
|
I have a problem with my class derived from CRichEditCtrl, I gladly text the Scroll event would intercept however it folds unfortunately.
White someone which there wrong I made?
BOOL CREditControl::PreTranslateMessage(MSG* pMsg)
{
switch(pMsg->wParam )
{
case VK_SCROLL:
//Test
AfxMessageBox("VK_SCROLL");
return true;
}
return CRichEditCtrl::PreTranslateMessage(pMsg);
}
thanks, Matthias
|
|
|
|
|
Hi,
In a Win32 Application I would like to check if command line parameters
/b /a is provided. The Messagebox show me the parametters like
/b /a but the if condition do not met it alwasy the else statment
that apply.
if ("/b" == szCmdLine || szCmdLine == "/a")
{
MessageBox (NULL, szCmdLine,"met",0);
}
else
{
MessageBox (NULL, szCmdLine,"Not met",0);
}
I did also chcked "//b" == szCmdLine. What I am missing?
Regards.
|
|
|
|
|
if szCmdLine contains other parameters besides /a or /b, you will need to do this.
if (szCmdLine.Find("/b") >= 0 || szCmdLine.Find("/a") >= 0)
{
MessageBox (NULL, szCmdLine,"met",0);
}
else
{
MessageBox (NULL, szCmdLine,"Not met",0);
}
|
|
|
|
|
Use Paul DiLascia's CCommandLineInfoEx class for this.
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Hi,
I've created a win32 app, and it runs perfectly till i've added #include <shellapi.h> for using the systemtray icons.
The trouble is in CreateWindow, now it returns NULL.
I put the include in myapp.cpp and nothing, and I've put it in stdafx.h, neither.
However, if I don't use Shell_NotifyIcon, so I don't need this header, CreateWindow returns a valid value.
What am I doing wrong?
Thanks.
|
|
|
|
|
Hi,
Our app calls an instance of Word. A custom Toolbar in Word contains a button "Back to App", which will close the word instance and, on Win NT, returns to the app. In Xp however this is not the case. The focus is not necessarely set back to our app.
Can anyone give me a hint how to set the input focus from where it came.
I'm searching in the direction of SetActiveWindow/SetForegroundWindow. (correct?)
tnx for your help.
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
On XP and an application cannot set itself as the active app, however another app can. So using SetForegroundWindow( YourApp ) from Word should work correctly. I had a similar problem to this 3-4 weeks back. Do a search here on SetForegroundWindow() and you will find that thread and the respones I got.
Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"
|
|
|
|
|
tnx a lot, I'll have a look into it, let's hope I do not have such problems as you had .
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|
|
|
Hi there
I am receiving asynch serial data successfully using a thread.
But I noticed that the time the data arrives is never the same. It actually arrives at say time (y), then at Time (y+1), (y+2)... until (y+10). Then it jumps back to time (y). The transmission time is accurate always at 100ms intervals.
Can anyone maybe tell me why this is the case AND what I should look for to correct it. Maybe a setting somewhere.
Thanks
|
|
|
|
|
Most probably the directory location. Is the file you are reading in the same directory as your app ? Are you loading "myfile.dat" or "L:\Mypath\myfile.dat" ?
When loading manually, the current directory must be your app directory, so it can find the file. Otherwise it is the different programm directory, where your data file is not found.
~RaGE();
|
|
|
|
|
Well the file in in the same dir,
But if I start this program with a diffrent program I don't find the file and if I debug the program I find the file but it don't connect to the network. But if I start the program manoly it works greate.
|
|
|
|
|
What are the error codes/messages you get when the file fails to open?
"An expert is a person who has made all the mistakes that can be made in a very narrow field." - Neils Bohr
|
|
|
|
|
You are most likely being plagued by absolute vs. relative paths. To verify, specify an absolute path in the program.
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I have a program that read in a file and if a start the program from a diffrent program it don't work but if I start the program manuly it works! What is the problem?.
|
|
|
|
|
Using VC++6
I am reading a value stored in a text field as follows:
First/Last
Want to change it to (reverse the "/"):
First\Last
and store it back
Any help will be greatly appreciated
|
|
|
|