|
Try this code...
CString GetUnstallPath(){
HKEY hKey;
DWORD dwSize;
TCHAR szInstallDirectory[_MAX_PATH];
CString sTmp;
// First off, see if the Reg key exists, if so
if (::RegOpenKey(HKEY_CURRENT_USER,
"SOFTWARE\\RCAS\\UninstallInfo",
&hKey) != ERROR_SUCCESS)
{
sTmp = "";
return sTmp; // empty string or error handling
}
// Get the Value from the Registry
if(::RegQueryValueEx(hKey,
"InstallDirectory",
NULL,
NULL,
(LPBYTE)szInstallDirectory,
&dwSize) != ERROR_SUCCESS )
{
::RegCloseKey(hKey);
sTmp = "";
return sTmp; // empty string or error handling
}
::RegCloseKey(hKey);
// Add a zero termintion
szValue[dwSize] = '\0';
sTmp.Format("%s",szInstallDirectory); // or sTmp=szInstallDirectory
return sTmp;
}
This assums that the Reg Entry is a "normal" string and does not need to be expanded.
hope this helps
|
|
|
|
|
Peter Liddle wrote:
DWORD dwLengthOfInstallDirectory = NULL;
You need to set that to the size of your buffer before calling RegQueryValueEx(). As it is now, you're telling it that you have a buffer of size 0, so it'll never return any data.
--Mike--
My really out-of-date homepage
Buffy's on. Gotta go, bye!
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
I have almost finished a program and I want to create a setup App. I was wondering should I go with MS's Installer thingy, use Self-extracting, or a cab file type installation. I don't care which one is easier I am just wondering what you guys would suggest.
- Matt Newman
- Matt Newman
-Sonork ID: 100.11179:BestSnowman
|
|
|
|
|
IMHO, Window's Installer is where things are moving. It has some drawbacks. First would be that older systems would have to download the installer programm (1.4meg) if they don't have the installer installed.
Now, for a free MSI option, you can use the Microsoft Visual Studio Installer.
Tim Smith
Descartes Systems Sciences, Inc.
|
|
|
|
|
I was think of it but wasn't sure. Thanks for the advice.
- Matt Newman
- Matt Newman
-Sonork ID: 100.11179:BestSnowman
|
|
|
|
|
MHO is that, for a simple program, MSI is about 1000x too much overkill. MSI is great for stuff like Office or VC7, which have a million features. If you just have an EXE and a couple DLLs, there is zero reason to impose MSI (and its 1.5MB download) on your users.
For the CP SearchBar, which is one COM server and a couple other files, I just wrote my own simple installer that prompts for the install dir and drops the files there, and registers the DLL. I then put them in a self-extractor using WinZip. The whole procedure took maybe half a day. I can send you the installer source if you like.
--Mike--
My really out-of-date homepage
Buffy's on. Gotta go, bye!
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
Michael Dunn wrote:
MHO is that, for a simple program, MSI is about 1000x too much overkill. MSI is great for stuff like Office or VC7, which have a million features. If you just have an EXE and a couple DLLs, there is zero reason to impose MSI (and its 1.5MB download) on your users.
Good Point
Michael Dunn wrote:
For the CP SearchBar, which is one COM server and a couple other files, I just wrote my own simple installer that prompts for the install dir and drops the files there, and registers the DLL. I then put them in a self-extractor using WinZip. The whole procedure took maybe half a day. I can send you the installer source if you like
I don't really need any code (No Offense). I was planning on creating on for specific use.
Thanks for the tips.
- Matt Newman
- Matt Newman
-Sonork ID: 100.11179:BestSnowman
|
|
|
|
|
|
Michael Dunn wrote:
Chill out. I was just saying I wanted to do it by myself.
- Matt Newman
- Matt Newman
-Sonork ID: 100.11179:BestSnowman
|
|
|
|
|
I want to right to a .txt file. I have a formated CString and I want each time it writes to do it on a new line. Can anyone help me?
- Matt Newman
- Matt Newman
-Sonork ID: 100.11179:BestSnowman
|
|
|
|
|
Assuming fOut is a legal output FILE*, and sFoo is your string:
fprintf(fOut, "%s\n", (LPCSTR)sFoo);
Just one of the gazillion ways to do it.
/Mike
|
|
|
|
|
Perhaps the ::fputs(...) function?
This assumes you are using the C RTL, of course...
-=- James.
|
|
|
|
|
If you are using MFC (and it seems that you are ) the best way to go is to use CStdioFile::WriteString
I vote pro drink
|
|
|
|
|
I haven't tried it yet but I think this is what I am looking for.
- Matt Newman
- Matt Newman
-Sonork ID: 100.11179:BestSnowman
|
|
|
|
|
Hi,
I'm trying to work out how to set a connection timeout for winsocks without using MFC.
(With MFC you just set m_nTimeOut to the required timeout in ms before you call Connect()).
I know you can use setsockopt to set the send and receive timeouts, but is there any way to set the connection timeout?
Many thanks,
Peter Pearson
|
|
|
|
|
I know you can use setsockopt to set the send and receive timeouts, but is there any way to set the connection timeout?
This isn't really a winsock question but more a common sockets question, isn't it?
If setsockopt works, why do you want to find another way to do it? Maybe there is some obscure WSA* function to do it, but why bother?
/Mike
|
|
|
|
|
when will the function execute?
i have set a breakpoint in the first line, but program doest step into.
in fact, i want to Draw something in OnIntialUpdate() function, but MSDN said
it won't be useful, becoz when the function finished, it will send a WM_PAINT
cause the Client to be invalidated, all the drawings will disappear.
how can i finish it?
one is the other who absorbs the thoughts of others
|
|
|
|
|
just a thought
are you trying to draw in a control view? (ie, clistview, ctreeview, etc) 'cos if you are it never gets called ... use the OnUpdate() function instead
might be off the mark but its a thought
---
"every year we invent better idiot proof systems and every year they invent better idiots ... and the linux zealots still aren't being sterilized"
|
|
|
|
|
no, such as pDC->TextOut(xpos,ypos,text);
it wont display on the view's screen
one is the other who absorbs the thoughts of others
|
|
|
|
|
Do you have an OnPaint as well ? Have you tried drawing in OnDraw and see if it appears or not ?
Have you tried Spy++ to see what messages the window is recieving ??
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
it seems no need to write OnPaint
First, the program won' t step into the OnDraw Function, why?
one is the other who absorbs the thoughts of others
|
|
|
|
|
ooze wrote:
First, the program won' t step into the OnDraw Function, why?
Well, looking through the code you posted, it seems to me - no, wait....
ooze wrote:
it seems no need to write OnPaint
I have a vague recollection that overriding OnPaint stops OnDraw from being called - that was why I asked.
I just created a vanilla SDI app and my OnDraw is getting called. Did you try Spy ++ ? If you still can't see it, you should probably post some code, but if OnPaint and OnDraw are both not getting called, I don't see how your window can *be* at all. BTW you want OnPrepareDC instead of OnDraw anyhow, if you want to avoid flicker.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
i comments the code in OnPaint, the OnDraw won't work
but if i comment all the function of OnPaint, OnDraw works, why?
thanks lots
one is the other who absorbs the thoughts of others
|
|
|
|
|
So it appears I was right ? Anyhow, I don't know *why* it works this way, but it makes sense, given that both functions basically do the same thing.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
i comments the code in OnPaint, the OnDraw won't work
but if i comment all the function of OnPaint, OnDraw works, why?
as the MSDN said,
Called by the framework to render an image of the document. The framework calls this function to perform screen display, printing, and print preview, and it passes a different device context in each case. There is no default implementation.
i want to know when will this function be exectued?
thanks lots
one is the other who absorbs the thoughts of others
|
|
|
|