|
I had exactly the same problem as you do. When the program runs from the start menu for some odd reason it thinks that the current running directory is the desktop (or the path the desktop ini file). To fix this problem you need to do the following:
LPTSTR szCmdLine;
szCmdLine = ::GetCommandLine();
CString strPath( szCmdLine );
int iCharPos = strPath.ReverseFind( '\\' );
strPath.SetAt( iCharPos, '\0' );
for( int j = 0; j < strPath.GetLength() - 1; j++ )
{
strPath.SetAt( j, strPath[j+1]);
}
if(!::SetCurrentDirectory( (LPCTSTR)strPath ) )
This problem is not innosetup related.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
AFAIK you have to set the working (start in) directory for the shortcut.
In the [Icons] section, set the directory in the WorkingDir entry. See your InnoSetup help files for more info.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
AFAIK you have to set the working (start in) directory for the shortcut.
In the [Icons] section, set the directory in the WorkingDir entry. See your InnoSetup help files for more info.
PJ Arends, it is not possible to set a working directory because the user can specify the directory himself.
Or am i misunderstanding?
<edit> I think this is a innosetup related problem because, if the user himself makes a shortcut to the program the program will be launched correctly
|
|
|
|
|
JensB wrote:
I think this is a innosetup related problem because, if the user himself makes a shortcut to the program the program will be launched correctly
I don't think that this problem relates to InnoSetup at all because I had to deal with this problem when I used InstallShield and Windows Installer.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
ah ok. I'll try that code out that you have provided me.
I'll let you know when it worked
|
|
|
|
|
YIHA
it works great!
Thanks alot Toni for helping out. :->)
|
|
|
|
|
JensB wrote:
Thanks alot Toni for helping out. :->)
You are welcome.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
JensB wrote:
PJ Arends, it is not possible to set a working directory because the user can specify the directory himself.
Or am i misunderstanding?
You are misunderstanding. You set it to {app} which is where the user selected the application to be installed.. See the documentation on that PJ suggested.
John
|
|
|
|
|
PJ Arends wrote:
In the [Icons] section, set the directory in the WorkingDir entry. See your InnoSetup help files for more info.
You are so right. Sorry but I didn't really read your message and I wrongfully insisted on my answer.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
hi there
i have a problem...
i added a lib (+ description header file) to my test project ... ( cwinapp + own editet cdialog ) all works fine ...
but when i try to add a declare_message_map and a begin_message_map the dialog wont be shown anymore...(but it works without problems when using a windowproc...)
can it be that there is a problem in the lib/header?
(perhaps its a common problem and all of you know what im talking about? )
|
|
|
|
|
Hi
If you have implemented a new dialog (a child of CDialog) with the functions from the Visual Studio, you have in this dialog-class a message_map and you don't must implement a new message_map.
For Windows messages use the class-wizard to create the handle-functions e.g. OnCreate() for WM_CREATE (see below in the message_map -> ON_WM_CREATE())
For your own messages use the macro ON_MESSAGE in the excisting message_map
e.g.
BEGIN_MESSAGE_MAP(CMainFrame, CMDIFrameWnd)
ON_MESSAGE(WM_OWN_MESSAGE, MyOwnFunction)
//{{AFX_MSG_MAP(CMainFrame)
ON_WM_CREATE()
.....
END_MESSAGE_MAP()
If your dialog complete without MFC, use the windowproc()-function
Regards
Frank
|
|
|
|
|
Hi Guys!!
I want to check Internet connectivity on my machine. I`ve reproduced my code below.
The code works fine except if IE is in offline mode.i.e i am unable to detect offline mode..
#include "stdafx.h"
#include "Wininet.h"
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
BOOL bConnected = FALSE;
DWORD dwFlags;
bConnected = InternetGetConnectedState ( &dwFlags, 0 );
if ( bConnected )
if ( dwFlags & INTERNET_CONNECTION_OFFLINE )
bConnected = FALSE;
if (bConnected )
MessageBox(0,"WOW ! Internet is Connected !","",0);
else
MessageBox(0, "Oops ! Internet is not Connected !","",0);
return 0;
}
Regards!!
Abhi
P.S Tony, Ryan please have a look.
|
|
|
|
|
Isn't bConnected false when InternetGetConnectedState returns? What is the return value?
Let's ignore bConnected for a moment.
Change these lines:
if ( bConnected )
if ( dwFlags & INTERNET_CONNECTION_OFFLINE )
bConnected = FALSE;
to:
if ( dwFlags & INTERNET_CONNECTION_OFFLINE )
bConnected = FALSE;
and tell me what happens. What is the value of dwFlags?
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
Ya the bConnected value is false in Offline mode too.
I tried by removing the condition [if(bConnected)] but still does not work.
The value of dwFlags "in disconnected and Work offline mode" is 16
while in connected mode it is 18.
Do u have any clue?
Abhi
|
|
|
|
|
If bConnected is false then it means that the internet is not connected (but I believe that you know that already). I thought you were getting bConnected = TRUE, even though you were offline. That's why I asked you to remove [if(bConnected)] just too see what would happen. You shouldn't get worried about the dwFlags value. I bet you want to know why the dwFlags doesn't have the INTERNET_CONNECTION_OFFLINE flags set? Sorry, but I don't have an answer for that.
To wrap things up, your code works fine.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
Hi all,
I want to create an application in VC++ and have the following question.
1. Which project type i should choose, whether MFC.exe or AppWizard.
2. After creating interface, User should login to application. This login user id and password at the value avaible in database(MSaccess). Here say on OK action i create CDatabase Instance and open the database.
I want to use this instance for the rest of dialog to open other tables in the database. My question is how to make it gobally avaible.
Can someone point to me a link or good site. I am beginner in this language.
Thanks in advance,
Regards
Valli
|
|
|
|
|
2. Use a singleton.
Jonathan de Halleux.
|
|
|
|
|
ValliS wrote:
After creating interface, User should login to application. This login user id and password at the value avaible in database(MSaccess). Here say on OK action i create CDatabase Instance and open the database.
Make your CDatabase instance a member of your CWinApp derived class. You can then access it anywhere in your project by using AfxGetApp.
Michael
'War is at best barbarism...Its glory is all moonshine. It is only those who have neither fired a shot nor heard the shrieks and groans of the wounded who cry aloud for blood, more vengeance, more desolation. War is hell.' - General William Sherman, 1879
|
|
|
|
|
Thanks for the replies. I will try it.
Regards
Valli
|
|
|
|
|
I want to shutdown the other PC through programatically. All PC r already connected through network.
If we can shutdown one PC which is WN2000 and other is WNME.
If anyone know Plz tell me.
|
|
|
|
|
ExitWindowsEx( EWX_SHUTDOWN, 0 ).
Check out the other flags that this function uses as well because I am just giving you an example, which might not always apply to your case.
You can also check InitiateSystemShutdownEx.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
I want to ask one more question.
If we can shutdown one PC which is WN2000 and other is WNME. Both of them r connected through network
If anyone know Plz tell me.
|
|
|
|
|
To shutdown another PC, use InitiateSystemShutdownEx() , but this only works for Win2k/XP PCs. You can't shutdown a remote Win9x/ME system without writing a server that runs on that machine and communicating with the program over the network.
Hope this helps,
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 should start reading the questions more carefully. He is asking how to shutdown a computer through a network and I didn't even get that part!!!
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
I want to make a programme which shutdown the Other PC(means which is already connected to the network).
can we do it.
|
|
|
|