|
I have made an shortcut of an exe form pc "pws19" to another pc
This shortcut's property shows the location as
"C:\Documents and Settings\vibin\Desktop" in General Tab
and its target is like
"\\pws19\FileTransfer\hai.exe" int Shortcut Tab.
Could i know how to get both the path in MFC.
VIBIN
Sim Infosys
|
|
|
|
|
????? wrote: Could i know how to get both the path in MFC.
Try SHGetFolderLocation or SHGetFolderPath
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
can u explain a little more? I didnt get u ...
nave
|
|
|
|
|
any way check the following sections in the link. Is that what u want?
1. Detect if an executable was started from a Short-Cut
2. Resolve shortcut
http://www.catch22.net/tuts/tips2.asp[^]
nave
|
|
|
|
|
Using the application's obects data member "m_pszHelpFilePath"
i can get the target path.(where the exe is really stored).
Now i need the path where the short cut of the exe is stored.
VIBIN
Sim Infosys
|
|
|
|
|
vibindia wrote: Using the application's obects data member "m_pszHelpFilePath"
i can get the target path.(where the exe is really stored).
u should use GetModuleFileName() to retrive the path o exe instead of the above trick.
u can get the path of short cut( if the process is started using a short cut ) using the GetStartupInfo() function. This method is explain in the link that i supplied in previous post under the section Detect if an executable was started from a Short-Cut. Did u check that?
nave
|
|
|
|
|
Naveen, please type plain words... "u" is not a proper word. please use "you" instead.
|
|
|
|
|
toxcct wrote: please use "you" instead.
I will try. What the problem is it has a become a habit And I think "u" is common short hand used instead of "you" now a days.
nave
|
|
|
|
|
please try, because it's not that easy to read, especially for youngers, or beginners which don't speak english naturally.
if we speak english as a common language, let's speak english then (not sms-glish)
|
|
|
|
|
Use GetModuleFileName() to get the path to the EXE. As for the path to the shortcut that launched the EXE, AFAIK that info isn't available to the process. Explorer reads the shortcut and calls CreateProcess() , but once the process is running, the shortcut is no longer relevant.
|
|
|
|
|
Michael Dunn wrote: that info isn't available to the
its available
Please check my post
nave
|
|
|
|
|
Hi,
I need to find out informations like version info, company name, description of a dll file.
Is there any api available to do this ?.
Kindly help me..
Thanks.
|
|
|
|
|
Check out GetFileVersionInfoSize(), GetFileVersionInfo(), VerQueryValue().
Mark
|
|
|
|
|
How to use these functions?.
Can you show me one simple example ?.
Thanks.
Nice things do nice works
|
|
|
|
|
|
Here's one way to read the VERSIONINFO resource of a file (if it exists)
LPCTSTR pszFileName = _T("C:\\TEST.DLL");
DWORD FVHandle;
DWORD dwSize = ::GetFileVersionInfoSize(pszFileName, &FVHandle);
if (dwSize)
{
void *pVersionData = (LPVOID)new BYTE[dwSize];
if (::GetFileVersionInfo(pszFileName, FVHandle, dwSize, pVersionData))
{
TCHAR szSubBlockName[256];
UINT nSize;
const VS_FIXEDFILEINFO *pFixedFileInfo;
_tcscpy(szSubBlockName,_T("\\"));
if (::VerQueryValue(pVersionData, szSubBlockName, (void **)&pFixedFileInfo, &nSize))
{
}
}
delete[] (BYTE *)pVersionData;
}
Strings like company name, program name, copyright, etc. in a VERSIONINFO resource can exist in
several languages so it's slightly trickier retrieving those.
Mark
|
|
|
|
|
|
I am using SHBrowseForFolderA for showing a file dialog. The length of the selected path is geyting trimmed.
I've used these flags
bi.ulFlags = BIF_RETURNONLYFSDIRS | BIF_STATUSTEXT;
Is there any way by which i can increase the size of the label in the dilaog box for the currently selected path.
Thanks,
---Arun.
|
|
|
|
|
arunperi wrote: I am using SHBrowseForFolderA for showing a file dialog.
It is used to browse folders .
Can you show code, what you are trying ? And explain a bit clearer ?
|
|
|
|
|
I think I saw examples on the codeproject change size or insert a controls to this dialog did you search on the codeproject.
|
|
|
|
|
Hello All,
I have a working timer in MFC can anyone tell me how to change it to Win 32.
MFC Timer Code.<br />
<br />
#define ELAPSED_TIMER 101<br />
time_t lStopTime;<br />
time_t lStartTime;<br />
CTimeSpan cteElapsedTime;
<br />
time(&lStartTime);<br />
SetTimer(s->m_hWnd,ELAPSED_TIMER, 1000, NULL);<br />
<br />
KillTimer(s->m_hWnd, ELAPSED_TIMER);
<br />
void CSDlg::OnTimer(UINT nIDEvent) <br />
{<br />
if(nIDEvent == ELAPSED_TIMER)<br />
{<br />
time(&lStopTime);<br />
cteElapsedTime = CTimeSpan(lStopTime-lStartTime); <br />
CString csElapsedTime;<br />
csElapsedTime.Format("%02d:%02d:%02d", <br />
cteElapsedTime.GetHours(),<br />
cteElapsedTime.GetMinutes(),<br />
cteElapsedTime.GetSeconds());<br />
if(IsWindowVisible())<br />
{<br />
m_TIME.SetWindowText(csElapsedTime);<br />
}<br />
} <br />
CDialog::OnTimer(nIDEvent);<br />
}
How to change it to win 32 application ?? what are the changes which I have to make in the below code????
<br />
<br />
int APIENTRY WinMain(HINSTANCE hInstance,<br />
HINSTANCE hPrevInstance,<br />
LPSTR lpCmdLine,<br />
int nCmdShow)<br />
{<br />
INT_PTR mRet = DialogBox(hInstance, <br />
MAKEINTRESOURCE(IDD_MAIN),<br />
GetDesktopWindow(),<br />
MainDlgProc);<br />
return 0;<br />
} <br />
<br />
<br />
BOOL CALLBACK MainDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)<br />
{<br />
<br />
switch(Message)<br />
{<br />
<br />
case WM_INITDIALOG:<br />
{<br />
SetTimer(hwnd,IDT_TIMER, 1000,(TIMERPROC) NULL); <br />
}<br />
break;<br />
<br />
<br />
case WM_CLOSE:<br />
EndDialog(hwnd, 0);<br />
break;<br />
<br />
case WM_COMMAND:<br />
<br />
switch(LOWORD(wParam))<br />
{<br />
case IDC_EXIT:<br />
EndDialog(hwnd, 0);<br />
break; <br />
<br />
case IDC_Start:<br />
<br />
break;<br />
<br />
case IDC_End:<br />
KillTimer(hwnd, IDT_TIMER);<br />
break;<br />
}<br />
default:<br />
return FALSE;<br />
}<br />
return TRUE;<br />
}
Thanking you,
Suresh HC
|
|
|
|
|
Suresh H wrote: BOOL CALLBACK MainDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
switch(Message)
{
You need to add one more case here,
case WM_TIMER:
if((UINT)wParam== ELAPSED_TIMER)
{
}
|
|
|
|
|
Hi Prasad,
Thanks for the response.
In the declaration only I am getting error. But it is working in MFC.
Hw to do it in Win32 ???
#define ELAPSED_TIMER 101<br />
time_t lStopTime;<br />
time_t lStartTime;<br />
CTimeSpan cteElapsedTime;
error C2146: syntax error : missing ';' before identifier 'cteElapsedTime'
error C2501: 'CTimeSpan' : missing storage-class or type specifiers
fatal error C1004: unexpected end of file found
|
|
|
|
|
Suresh H wrote: error C2146: syntax error : missing ';' before identifier 'cteElapsedTime'
error C2501: 'CTimeSpan' : missing storage-class or type specifiers
Its MFC stuff.
Use difftime instead. See its MSDN example.
|
|
|
|
|
Hi Prasad,
No much information in MSDN.
i got this link for win32 timers.
http://msdn2.microsoft.com/en-us/library/ms632592.aspx
|
|
|
|