|
I've got a problem.
I Want that when you press the button (see link plz) open a pdf file with the instructions of use.
http://www.imagecash.net/image.php?file=265709030
I can open file use this code
<br />
ShellExecute(this->m_hWnd,"open",<br />
"C:\\motor.pdf","","",SW_SHOW );
But this program is to use for many people, and the path changes computer to computer.
How can I solve this?
How can I make a setup that includes MFC files with microsoft visual studio 6?
thx
|
|
|
|
|
You can open the file Open dialog
Ask the user to select the file to open
Get the path from that fileopen dialog.
and then use ShellExecute with that path
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Holy cow !! When posting, inform people that your link contains not worksafe contents !
marcogja wrote: But this program is to use for many people, and the path changes computer to computer.
That seems logical no ? It won't start a search on your computer to find the required file. Supply the file with the program and put it in a specific folder where it can be found, that's the standard solution.
marcogja wrote: How can I make a setup that includes MFC files with microsoft visual studio 6?
Does that have something to do with your previous question ? If yes, I don't understand.
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
marcogja wrote: can open file use this codeShellExecute(this->m_hWnd,"open","C:\\motor.pdf","","",SW_SHOW );
either keep that path in any inifile or ask user about file path when ever you Application run!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
J have an application in MFC. There is one dialog window.
I want to hide the icon "close" which is inthe right upper corner of the window. What I have to do in my programm?
Regards
|
|
|
|
|
take the properties of the dialog in resources..
in the style tab uncheck the System menu check box..;)
nave
|
|
|
|
|
Yes, I know, thank you, but I want to know how to do it in the code source.
Regards
|
|
|
|
|
When u want to remove the close menu.
write
ModifyStyle( WS_SYSMENU,0 );
nave
|
|
|
|
|
When you want the Sysmenu to be visible
SetWindowLong(GetSafeHwnd(),GWL_STYLE,WS_SYSMENU | GetWindowLong(GetSafeHwnd(),GWL_STYLE));
RedrawWindow(NULL, NULL,RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN); When you don't want the Sysmenu to be visible
SetWindowLong(GetSafeHwnd(),GWL_STYLE,~WS_SYSMENU & GetWindowLong(GetSafeHwnd(),GWL_STYLE));
RedrawWindow(NULL, NULL,RDW_ERASE | RDW_INVALIDATE | RDW_FRAME | RDW_ALLCHILDREN); Hope this helps you
Knock out 'T' from CAN'T ,
You 'CAN' if you think you 'CAN'
|
|
|
|
|
i am trying to read the path of installation of adobe acrobat from the registry( is there any other way), in order to launch it in my program. i have tried RegQueryInfoKey to get the value from
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppPaths\AcroRd32.exe
from the default string in this key. were the path is.
but i am unable to read the value.
please help
|
|
|
|
|
Hi,
In which way do you want to read out any value using RegQueryInfoKey ?
To read value use RegQueryValueEx.
-----------
Mila
|
|
|
|
|
thanks for pointin out... but i have used RegQueryValueEx as well. but i am not sure if i am doin it correctly.
but nothin worked.
|
|
|
|
|
HKEY hKey = NULL;
LONG lRet = NULL;
char szProductType[1024] = { '\0' };
DWORD dwBufLen=1024;
lRet = RegOpenKeyEx( HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\AcroRd32.exe", 0, KEY_QUERY_VALUE, &hKey );
if( lRet != ERROR_SUCCESS ) return FALSE;
lRet = RegQueryValueEx( hKey, "", NULL, NULL, (LPBYTE) szProductType, &dwBufLen);
RegCloseKey( hKey );
It has to work properly - if not check which error codes returns RegOpenKeyEx & then RegQueryValueEx.
-----------
Mila
|
|
|
|
|
i tried that too. the return valur in both the function is 2 and the data in szProductType is 00000s. i am usin RegQueryInfoKey funtion before the code sent by u. is that an error?
|
|
|
|
|
check that registry path looks like:
"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\AcroRd32.exe"
and NOT
"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\AcroRd32.exe"
- this is very popular mistake
-----------
Mila
|
|
|
|
|
this is how i am usin it:
lRet = RegOpenKeyEx( HKEY_LOCAL_MACHINE, (LPCWSTR)("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\AcroRd32.exe"), 0, KEY_QUERY_VALUE, &hKey );
lRet = RegQueryValueEx( hKey, (LPCWSTR)"", NULL, NULL, (LPBYTE) szProductType, &dwBufLen);
as the complier was givin error for the 2nd parameter in both the functions in had to include (LPCWSTR) as a type castin measure
there was an pointer in the szProductType but in it was an array of zeros.
|
|
|
|
|
if you using UNICODE version of functions you should give wide text path:
lRet = RegOpenKeyEx( HKEY_LOCAL_MACHINE, (LPCWSTR)(L"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\AcroRd32.exe"), 0, KEY_QUERY_VALUE, &hKey );
the same thing will be in case RegQueryValueEx. In wide version
lRet = RegQueryValueExW( hKey, L"", NULL, NULL, (LPBYTE) szProductType, &dwBufLen);
... and all ... good luck!
-----------
Mila
|
|
|
|
|
iLL eFFect wrote: i am trying to read the path of installation of adobe acrobat from the registry( is there any other way),
Why not just use AssocQueryString(..., ".pdf", "open", szPath, ...) ?
"The largest fire starts but with the smallest spark." - David Crow
|
|
|
|
|
please elaborate on that. i dont know how to use it.
|
|
|
|
|
|
iLL eFFect wrote: AcroRd32.exe
is it Key or Data from which you have to reterive value!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
it is a key at the location:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppPaths\AcroRd32.exe
AcroRd32.exe is a folder and contains two vlaues default and Path.
|
|
|
|
|
iLL eFFect wrote: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\AppPaths\AcroRd32.exe
Try CRegKey
CRegKey myKey;
myKey.Open(HKEY_LOCAL_MACHINE,"\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\AppPaths\\AcroRd32.exe")==ERROR_SUCCESS)
{
CRegKey::QueryValue function!
}
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
I am looking for the header file (can be parallel.h ?) containing the definitions of the constants IOCTL_XXXXXX allowing to control the parallel port using the method DeviceIoControl() in Visual C++ under Windows XP.
Yves LEDUC
Industrial Computing Teacher
LPPO de la SALLE
FRANCE
|
|
|
|
|
The file you're looking for is indeed parallel.h and it ships with the DDK (Driver Development Kit).
--
Roger
It's supposed to be hard, otherwise anybody could do it!
Regarding CodeProject: "resistance is pointless; you will be assimilated"
|
|
|
|