|
Hello everyone,
Depends.exe is not shipped any more in VS 2008? I have a full installation of VS 2008 Team Edition, but no such file found. In VS 2005, there is related one.
It is not shipped any more or have some alternative ones?
thanks in advance,
George
|
|
|
|
|
Yes.
You can download a new version than that in VC6.0.
logics
|
|
|
|
|
Thanks followait,
I am surprised.
1. Are there any documents about depends.exe is not supported any more?
2. Are there any alternative tools besides the old depends.exe?
3. What means "new version that than in VC6.0."? I am using the one from VS 2005, is it the lastest version? If not, could you provide a link please?
regards,
George
|
|
|
|
|
I jump from VC++ 6.0 to VC++ 2008.
logics
|
|
|
|
|
Hi followait,
What is your point? In your VS 2008 it ships with depends.exe or not?
regards,
George
|
|
|
|
|
The latest version of Dependency Walker (newer than the one included in VS 2005) can be downloaded here: http://dependencywalker.com/[^].
Best regards
Dominik
|
|
|
|
|
Thanks Dominik,
I understand it could be downloaded there. But my question is VS 2008 is not shipped with depends.exe and we need to download manually?
regards,
George
|
|
|
|
|
George_George wrote:
I understand it could be downloaded there. But my question is VS 2008 is not shipped with depends.exe and we need to download manually?
Follow these steps:
a) You have VS 2008.
b) It was not installed with depends.exe
c) You like depends.exe, and find it useful. (As do I).
d) Realise that it's not really that important that microsoft no longer ships it - they're not going to change because you ask them nicely.
e) You really want it, so download it, or use an old copy.
f) Get over it, finish your work with the downloaded one, and go have a
Iain.
|
|
|
|
|
Thanks Iain!
regards,
George
|
|
|
|
|
Im fairly new to C++ application programming but I was wondering If it is possible to skin your application in MFC or would it be better to go back to basic API
Regards
sarriss
|
|
|
|
|
It is probably a little easier to do with MFC than basic API, but the devil is in the details. Do you mean a dialog app that you can change the background on? In which case there are articles here to help. Do you mean choosing from list of templates, and they may not be rectangles? Search for SetWindowRgn on codeproject.
If you mean skinning like winamp, then unless you are a genius [*], it will be impossible for a novice windows app programmer. Be less ambitious, and learn the smaller bits before going all out!
Have a look at:
http://www.codeproject.com/KB/dialog/#Dialog & Windows - Skins & Advanced UI[^]
Iain.
[*] Like me!
|
|
|
|
|
aye, ive spent time learning win32 api recently to learn more on how window applications work, but hey its all good thnx for your time
|
|
|
|
|
Hello everyone,
Here is my below code for the DLL consumer and the DLL itself's code. I am using LoadLibrary and GetProcAddress to get the function pointer and then make a call. But statement " StoreDataFp StoreData = (StoreDataFp)GetProcAddress(hMod,TEXT("StoreData"))" always return 0 for StoreData. What is the root cause?
DLL Consumer code:
#include <windows.h>
#include <stdio.h>
#define THREADCOUNT 1
#define DLL_NAME TEXT("testdll.dll")
VOID ErrorExit(LPSTR);
typedef BOOL(*StoreDataFp)(DWORD);
typedef BOOL (*GetDataFp)(DWORD*);
DWORD WINAPI ThreadFunc(VOID)
{
int i;
HMODULE hMod;
hMod = LoadLibrary(TEXT("testdll.dll"));
StoreDataFp StoreData = (StoreDataFp)GetProcAddress(hMod,TEXT("StoreData"));
GetDataFp GetData = (GetDataFp)GetProcAddress(hMod, TEXT("GetData"));
if(!StoreData(GetCurrentThreadId()))
ErrorExit("StoreData error");
for(i=0; i<5; i++)
{
DWORD dwOut;
if(!GetData(&dwOut))
ErrorExit("GetData error");
if( dwOut != GetCurrentThreadId())
printf("thread %d: data is incorrect (%d)\n", GetCurrentThreadId(), dwOut);
else printf("thread %d: data is correct\n", GetCurrentThreadId());
Sleep(0);
}
return 0;
}
int main(VOID)
{
DWORD IDThread;
HANDLE hThread[THREADCOUNT];
int i;
LoadLibrary(DLL_NAME);
for (i = 0; i < THREADCOUNT; i++)
{
hThread[i] = CreateThread(NULL,
0,
(LPTHREAD_START_ROUTINE) ThreadFunc,
NULL,
0,
&IDThread);
if (hThread[i] == NULL)
ErrorExit("CreateThread error\n");
}
WaitForMultipleObjects(THREADCOUNT, hThread, TRUE, INFINITE);
return 0;
}
VOID ErrorExit (LPSTR lpszMessage)
{
fprintf(stderr, "%s\n", lpszMessage);
ExitProcess(0);
}
DLL code:
#include <windows.h>
static DWORD dwTlsIndex;
BOOL WINAPI DllMain(HINSTANCE hinstDLL,
DWORD fdwReason,
LPVOID lpvReserved)
{
LPVOID lpvData;
BOOL fIgnore;
switch (fdwReason)
{
case DLL_PROCESS_ATTACH:
if ((dwTlsIndex = TlsAlloc()) == TLS_OUT_OF_INDEXES)
return FALSE;
case DLL_THREAD_ATTACH:
lpvData = (LPVOID) LocalAlloc(LPTR, 256);
if (lpvData != NULL)
fIgnore = TlsSetValue(dwTlsIndex, lpvData);
break;
case DLL_THREAD_DETACH:
lpvData = TlsGetValue(dwTlsIndex);
if (lpvData != NULL)
LocalFree((HLOCAL) lpvData);
break;
case DLL_PROCESS_DETACH:
lpvData = TlsGetValue(dwTlsIndex);
if (lpvData != NULL)
LocalFree((HLOCAL) lpvData);
TlsFree(dwTlsIndex);
break;
default:
break;
}
return TRUE;
UNREFERENCED_PARAMETER(hinstDLL);
UNREFERENCED_PARAMETER(lpvReserved);
}
extern "C" __declspec(dllexport)BOOL WINAPI StoreData(DWORD dw)
{
LPVOID lpvData;
DWORD * pData;
lpvData = TlsGetValue(dwTlsIndex);
if (lpvData == NULL)
{
lpvData = (LPVOID) LocalAlloc(LPTR, 256);
if (lpvData == NULL)
return FALSE;
if (!TlsSetValue(dwTlsIndex, lpvData))
return FALSE;
}
pData = (DWORD *) lpvData;
(*pData) = dw;
return TRUE;
}
extern "C" __declspec(dllexport) BOOL WINAPI GetData(DWORD *pdw)
{
LPVOID lpvData;
DWORD * pData;
lpvData = TlsGetValue(dwTlsIndex);
if (lpvData == NULL)
return FALSE;
pData = (DWORD *) lpvData;
(*pdw) = (*pData);
return TRUE;
}
thanks in advance,
George
|
|
|
|
|
What's the value of GetLastError after GetProcAddress fails?
|
|
|
|
|
Hi Michael,
I have figured out it is because of name decoration issue. And I forget to create a DEF file. I want to confirm with you that even if I used extern C in my code for declare/define dllexport function, I still need to make a DEF file in order to disable name decoration issue?
regards,
George
|
|
|
|
|
msdn says _beginthreadex calls CreateThread internally. So, i think the return value should be similar with what returned by CreateThread. As msdn says, we can resume a thread created by CreateThread with CREATE_SUSPENDED flag. So, i use resume a thread created with CREATE_SUSPENDED flag, the the program will crash at ResumeThread call. but there is nothing related about how to resume a thread created by _beginthreadex.
So, how to resume a thread created by _beginthreadex?
|
|
|
|
|
I'm not sure I got you. Did you try to call beginthreadex with CREATE_SUSPENDED flag and then ResumeThread failed (making the application crash)?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
yes. so did the program crash at ResumeThread
|
|
|
|
|
Here's code from an old thread wrapper class of mine.
It never "crashed" for me.
bool CMyOldWorkerThread::Run(int priority, DWORD dwThreadCreateFlags)
{
hThread = (HANDLE)_beginthreadex(NULL, 0, WorkerThreadProc, (LPVOID)this,
CREATE_SUSPENDED | (unsigned)dwThreadCreateFlags, (unsigned *)&dwThreadId);
if (hThread)
{
::SetThreadPriority(hThread, priority);
if (0 == (dwThreadCreateFlags & CREATE_SUSPENDED))
{
::ResumeThread(hThread);
}
return true;
}
return false;
}
What are you doing differently?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks. it works well now. The crash dues to my carelessness, the reason was not the ResumeThread call.
|
|
|
|
|
Hello everyone,
Could anyone show me a sample about how to use these two commands in Windbg please? I read the document in debugger.chm, but confused. I did search in Google and MSDN, but not find an easy to learn sample.
thanks in advance,
George
|
|
|
|
|
Hi everybody,
i have a problem with the sizing of the rows of a splitter.
I coded a little sample with a main_splitter with 4 rows.
This is how it looks at startup.
http://filehosting.at/images/download.php?file=4dbf41d6c1a6e28de6a24e27e60ae9ee
[^]
Then the user could change the height of the rows, like this for example:
http://filehosting.at/images/download.php?file=d3f0203679e34d9bb3159d231e898d89[^]
But wen the user now maximize the window i want change the height proportional to the size of the window.
An when he change the height of the rows in fulscreen and restoe the windows i will change
the height of the rows proportional again.
here is my code, i try to figure it out fore hours now but it won't work
<code>
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
CRect spRect;
CRect cr;
GetClientRect(&cr);
GetClientRect(&spRect);
m_Splitter_Main.CreateStatic(this, 4, 1);
m_Splitter_Main.SetRowInfo(0, spRect.Height()/4, 0);
m_Splitter_Main.SetRowInfo(1, spRect.Height()/4, 0);
m_Splitter_Main.SetRowInfo(2, spRect.Height()/4, 0);
m_Splitter_Main.SetRowInfo(3, spRect.Height()/4, 0);
m_Splitter_Main.CreateView(1, 0, RUNTIME_CLASS(CTest_01View), CSize(0, cr.Height()/4), pContext);
m_Splitter_Main.CreateView(2, 0, RUNTIME_CLASS(CTest_01View), CSize(0, cr.Height()/4), pContext);
m_Splitter_Child_1.CreateStatic(&m_Splitter_Main, 1, 3, WS_CHILD | WS_VISIBLE, m_Splitter_Main.IdFromRowCol(0, 0));
m_Splitter_Child_1.CreateView(0, 0, RUNTIME_CLASS(CTest_01View), CSize(cr.Width()/3, 0), pContext);
m_Splitter_Child_1.CreateView(0, 1, RUNTIME_CLASS(CTest_01View), CSize(cr.Width()/3, 0), pContext);
m_Splitter_Child_1.CreateView(0, 2, RUNTIME_CLASS(CTest_01View), CSize(cr.Width()/3, 0), pContext);
m_Splitter_Child_2.CreateStatic(&m_Splitter_Main, 1, 2, WS_CHILD | WS_VISIBLE, m_Splitter_Main.IdFromRowCol(3, 0));
m_Splitter_Child_2.CreateView(0, 0, RUNTIME_CLASS(CTest_01View), CSize(cr.Width()/2, 0), pContext);
m_Splitter_Child_2.CreateView(0, 1, RUNTIME_CLASS(CTest_01View), CSize(cr.Width()/2, 0), pContext);
return TRUE;
}
void CMainFrame::OnSize(UINT nType, int cx, int cy)
{
CFrameWnd::OnSize(nType, cx, cy);
int iCur_cy, iMin_cy;
iMin_cy = 0;
CRect spRect;
m_Splitter_Main.GetClientRect(spRect);
if ((nType == SIZE_MAXIMIZED)||(m_Splitter_Main.IsWindowVisible() && nType == SIZE_RESTORED))
{
m_Splitter_Main.GetRowInfo(0 ,iCur_cy, iMin_cy);
m_Splitter_Main.SetRowInfo(0, iCur_cy, 0);
m_Splitter_Main.RecalcLayout();
}
}
</code>
I hope i could discribe the problem good enough !
Many thanks & best regards
Croc
|
|
|
|
|
Hello everyone,
I posted the source codes related with assembly code for a very simple program below. I have inlined my questions.
Let me repeat my question here,
1. ebp is not used in function main? only esp is used to represent variables on stack?
2. what is the purpose of rdx in statement "lea rdx,[rsp+30h]", store the 2nd parameter to operator <<, which is address of b (address of an integer)?
#include <iostream>
using namespace std;
int foo (int a)
{
int b;
cin >> b;
a = a * b;
return a;
}
int main()
{
0000000140001000 sub rsp,28h
cout << foo (10);
0000000140001004 mov rcx,qword ptr [__imp_std::cin (140002080h)]
000000014000100B lea rdx,[rsp+30h]
0000000140001010 call qword ptr [__imp_std::basic_istream<char,std::char_traits<char> >::operator>> (140002078h)]
0000000140001016 mov r11d,dword ptr [rsp+30h]
000000014000101B mov rcx,qword ptr [__imp_std::cout (140002090h)]
0000000140001022 lea edx,[r11+r11*4]
0000000140001026 add edx,edx
0000000140001028 call qword ptr [__imp_std::basic_ostream<char,std::char_traits<char> >::operator<< (140002088h)]
return 0;
000000014000102E xor eax,eax
}
regards,
George
|
|
|
|
|
rdx is the address of b.
It is optimized.
foo became inline, and ebp is also optimized away.
logics
|
|
|
|
|
Thanks followait,
So, ebp is always used or not? Previously I think ebp is always used even if in optimized code.
regards,
George
|
|
|
|
|