Click here to Skip to main content
15,907,913 members
Home / Discussions / C#
   

C#

 
GeneralRe: Removing the Close button on Modal Dialog Pin
sam#31-Oct-06 19:33
sam#31-Oct-06 19:33 
GeneralRe: Removing the Close button on Modal Dialog Pin
Robert Rohde31-Oct-06 21:29
Robert Rohde31-Oct-06 21:29 
AnswerRe: Removing the Close button on Modal Dialog Pin
Stefan Troschuetz31-Oct-06 21:27
Stefan Troschuetz31-Oct-06 21:27 
GeneralRe: Removing the Close button on Modal Dialog Pin
bankai1231-Nov-06 1:46
bankai1231-Nov-06 1:46 
QuestionGet Data from Lookup Form Pin
MJay31-Oct-06 16:28
MJay31-Oct-06 16:28 
AnswerRe: Get Data from Lookup Form Pin
luckykhalid31-Oct-06 18:48
luckykhalid31-Oct-06 18:48 
GeneralRe: Get Data from Lookup Form Pin
MJay31-Oct-06 20:00
MJay31-Oct-06 20:00 
QuestionCalling DLL from C# .NET 2005 - Some problems in parameters Pin
datvpsc7731-Oct-06 16:07
datvpsc7731-Oct-06 16:07 
Hi every body,

I have to call a DLL that contain a function follow:

typedef struct _ProStruct {
HANDLE hProcess;
HANDLE hThread;
DWORD dwProcessId;
DWORD dwThreadId;
} ProStruct

int MyBuggingFunc(long bDebugMode,ProStruct* pProStruct,TCHAR* Location);


When I call it in C# 2005 such as:

public struct ProStruct{
long hProcess;
long hThread;
int dwProcessId;
int dwThreadId;
}
[DllImport("MyBugFunc.dll",CallingConvention = CallingConvention.Cdecl)]
public static extern int MyBuggingFunc(int bDebugMode,
ProStruct pProStruct,String Location);

private void Form1_Load(object sender, EventArgs e)
{
try
{
ProStruct pPI = new ProStruct();
int ret = MyBuggingFunc((int)(1), pPI, "MyTest.dkt");
}
catch (Exception loi)
{
MessageBox.Show(loi.Message);
}
}


When the form is loaded, there is an error occurs:

"PInvokeStackImbalance was detected
Message: A call to PInvoke function 'WindowsApplication4!WindowsApplication4.Form1::MyBuggingFunc has unbalanced the stack. This is likely because the managed PInvoke signature does not match the unmanaged target signature. Check that the calling convention and parameters of the PInvoke signature match the target unmanaged signature.
"


I assume some parameters have incorrect type with convention in calling DLL from third party DLL. I tried to fix it many times but I get the the same error.

Could you help me to resolve my problem?

Thanks all of you!


Hoang Quoc Dat
AnswerRe: Calling DLL from C# .NET 2005 - Some problems in parameters Pin
Judah Gabriel Himango31-Oct-06 17:57
sponsorJudah Gabriel Himango31-Oct-06 17:57 
QuestionRe: Calling DLL from C# .NET 2005 - Some problems in parameters Pin
datvpsc7731-Oct-06 19:25
datvpsc7731-Oct-06 19:25 
GeneralRe: Calling DLL from C# .NET 2005 - Some problems in parameters Pin
datvpsc7731-Oct-06 19:29
datvpsc7731-Oct-06 19:29 
GeneralRe: Calling DLL from C# .NET 2005 - Some problems in parameters Pin
Judah Gabriel Himango31-Oct-06 19:59
sponsorJudah Gabriel Himango31-Oct-06 19:59 
QuestionWorking around the lack of friend classes Pin
matt cole31-Oct-06 14:04
matt cole31-Oct-06 14:04 
AnswerRe: Working around the lack of friend classes Pin
Christian Graus31-Oct-06 15:51
protectorChristian Graus31-Oct-06 15:51 
GeneralRe: Working around the lack of friend classes Pin
Judah Gabriel Himango31-Oct-06 18:02
sponsorJudah Gabriel Himango31-Oct-06 18:02 
AnswerRe: Working around the lack of friend classes Pin
Leslie Sanford31-Oct-06 18:09
Leslie Sanford31-Oct-06 18:09 
QuestionEdit DataRow in a DataSet Pin
teejayem31-Oct-06 13:27
teejayem31-Oct-06 13:27 
AnswerRe: Edit DataRow in a DataSet Pin
Tamimi - Code31-Oct-06 19:10
Tamimi - Code31-Oct-06 19:10 
QuestionHow to Encrypt Data and Save to Registry ? Pin
hdv21231-Oct-06 10:47
hdv21231-Oct-06 10:47 
AnswerRe: How to Encrypt Data and Save to Registry ? Pin
Christian Graus31-Oct-06 10:51
protectorChristian Graus31-Oct-06 10:51 
GeneralRe: How to Encrypt Data and Save to Registry ? Pin
hdv21231-Oct-06 13:21
hdv21231-Oct-06 13:21 
GeneralRe: How to Encrypt Data and Save to Registry ? Pin
Christian Graus31-Oct-06 15:52
protectorChristian Graus31-Oct-06 15:52 
GeneralRe: How to Encrypt Data and Save to Registry ? Pin
matt cole31-Oct-06 19:07
matt cole31-Oct-06 19:07 
GeneralRe: How to Encrypt Data and Save to Registry ? Pin
Haseeb Mukhtar31-Oct-06 19:54
Haseeb Mukhtar31-Oct-06 19:54 
QuestionNew buttons styles... Pin
Lucas Eduardo31-Oct-06 9:49
Lucas Eduardo31-Oct-06 9:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.