Click here to Skip to main content
15,888,454 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: How to write the current status in some file when system shuts down with Electricity failure Pin
Trollslayer29-May-06 3:42
mentorTrollslayer29-May-06 3:42 
GeneralRe: How to write the current status in some file when system shuts down with Electricity failure Pin
Eytukan29-May-06 6:20
Eytukan29-May-06 6:20 
GeneralRe: How to write the current status in some file when system shuts down with Electricity failure Pin
Trollslayer29-May-06 8:11
mentorTrollslayer29-May-06 8:11 
AnswerRe: How to write the current status in some file when system shuts down with Electricity failure Pin
Sarath C29-May-06 2:38
Sarath C29-May-06 2:38 
GeneralRe: How to write the current status in some file when system shuts down with Electricity failure Pin
Sebastian Schneider29-May-06 4:23
Sebastian Schneider29-May-06 4:23 
Questionadding Compressed HTML help with the application Pin
prashant.madhav29-May-06 1:46
prashant.madhav29-May-06 1:46 
AnswerRe: adding Compressed HTML help with the application Pin
Laxman Auti29-May-06 2:08
Laxman Auti29-May-06 2:08 
QuestionCall back function using child Thread Pin
Arun Tayal29-May-06 1:16
Arun Tayal29-May-06 1:16 
Please find the attached snippet of the code. In the following code I am trying to call a function written in VB using function pointer in VC++ dll. This code works fine if I use the function pointer in main thread. If I try to call the function in child thread then "Unhandled exeption occurs" Can anyone help me out......


Snippet from Win32 dll

// TempDLL.cpp : Defines the entry point for the DLL application.
//

#include "stdafx.h"

#include "MALLOC.H"
#include "STDLIB.H"


long extNumberProc;
HANDLE hThread;
DWORD dwThreadId;

struct strctValue
{
DWORD dw;
};

BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
return TRUE;
}


void WINAPI CallVBFunctionForNumber (char* lSomeValueToSend, DWORD s4)
{
typedef long (__stdcall *OutsideFunction)(char*); //Defining the prototype of the function.
OutsideFunction FunctionCall; //Creating an instance that will be used to call the function.
FunctionCall = (OutsideFunction)s4; //Assigning the address to be used for the call.
long da = FunctionCall("Lalit Kumar"); //Calling the function with the parameter.
}



DWORD WINAPI StartScanning(LPVOID lParam)
{

strctValue* s2;
s2 = (strctValue*)lParam;

CallVBFunctionForNumber("Lalit Kumar", s2->dw);
return 1;
}

void WINAPI getpointer(long x)
{

strctValue s1;
s1.dw = x;


BYTE* bptr = (BYTE*)malloc(sizeof(s1));
memcpy(bptr, &s1, sizeof(s1));


hThread = CreateThread(
NULL, // default security attributes
0, // use default stack size
StartScanning, // thread function
bptr, // argument to thread function
0, // use default creation flags
&dwThreadId); // returns the thread identifier
}




The Snippet from VB code is as follows:

Public Sub Callbackfuntion(ByVal str1 As String)

MsgBox "Callbackfuntion"
End Sub






Thanks in advance.............

Arun
AnswerRe: Call back function using child Thread Pin
Sarath C29-May-06 1:30
Sarath C29-May-06 1:30 
GeneralRe: Call back function using child Thread Pin
Arun Tayal29-May-06 1:38
Arun Tayal29-May-06 1:38 
QuestionWhere i can find wrapper class Pin
Immunity1829-May-06 0:54
Immunity1829-May-06 0:54 
AnswerRe: Where i can find wrapper class Pin
toxcct29-May-06 0:55
toxcct29-May-06 0:55 
GeneralRe: Where i can find wrapper class [modified] Pin
Immunity1829-May-06 0:59
Immunity1829-May-06 0:59 
GeneralRe: Where i can find wrapper class Pin
ThatsAlok30-May-06 1:24
ThatsAlok30-May-06 1:24 
AnswerRe: Where i can find wrapper class Pin
Eytukan29-May-06 1:03
Eytukan29-May-06 1:03 
GeneralRe: Where i can find wrapper class Pin
Immunity1829-May-06 1:04
Immunity1829-May-06 1:04 
GeneralRe: Where i can find wrapper class Pin
Eytukan29-May-06 1:07
Eytukan29-May-06 1:07 
GeneralRe: Where i can find wrapper class Pin
Immunity1829-May-06 1:09
Immunity1829-May-06 1:09 
GeneralRe: Where i can find wrapper class Pin
Eytukan29-May-06 1:11
Eytukan29-May-06 1:11 
GeneralRe: Where i can find wrapper class Pin
toxcct29-May-06 1:43
toxcct29-May-06 1:43 
QuestionVideo Pin
Anilkumar K V29-May-06 0:25
Anilkumar K V29-May-06 0:25 
AnswerRe: Video Pin
Laxman Auti29-May-06 0:39
Laxman Auti29-May-06 0:39 
AnswerRe: Video Pin
nsh_enp29-May-06 15:25
nsh_enp29-May-06 15:25 
QuestionSplitterWnd Pin
anu_8829-May-06 0:12
anu_8829-May-06 0:12 
AnswerRe: SplitterWnd Pin
_anil_29-May-06 0:24
_anil_29-May-06 0:24 

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.