Re: HELP: AfxBeginThread problem



You can pass one pointer. There is no reason to assume it is even possible to pass two
pointers. But if you can pass one pointer, you can pass anything you want, including a
pointer to a struct that contains two pointers. Just remember you must allocate this
object on the heap, not the stack.
joe

On Wed, 14 Sep 2005 21:18:43 +1200, "Hamish" <h.dean@xxxxxxxxxx> wrote:

>Hi.
>
>Previously, this has been how i've been beginning a new thread:
>
>AfxBeginThread(SomeFunction, this); //being called from my applications Doc
>class
>
>SomeFunction was a global function:
>
>UINT SomeFunction(LPVOID pParam);
>
>
>
>However, I want to add an extra parameter to SomeFunction:
>
>UINT SomeFunction(LPVOID pParam, DataClass * pData);
>
>So now when I go to start a thread with this function, how to I do it?
>
>AfxBeginThread(SomeFunction, this);
>i'm not passing in the pData, and the compiler says: error C2665:
>'AfxBeginThread' : none of the 2 overloads can convert parameter 1 from type
>'unsigned int (__cdecl *)(void *,class DataClass *)'
>
>AfxBeginThread(SomeFunction(this, pData), this);
>also does not work: error C2665: 'AfxBeginThread' : none of the 2 overloads
>can convert parameter 1 from type 'unsigned int'
>
>Ideas?
>
>
Joseph M. Newcomer [MVP]
email: newcomer@xxxxxxxxxxxx
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.



Relevant Pages

  • Re: Pocket PC - Pointer Crash
    ... PUSHORT pData; ... I'm de-referencing a pointer who's contents/values I can view without any ... problems in the memory watch window. ... int FOO ...
    (microsoft.public.pocketpc.developer)
  • void * C array to a Numpy array using Swig
    ... I have wrapped a C IO module using SWIG -> Python Module. ... Now a is the object which contains pointer to data of the image. ... get the data pointed by pdata). ...
    (comp.lang.python)
  • Re: void * C array to a Numpy array using Swig
    ... Now a is the object which contains pointer to data of the image. ... get the data pointed by pdata). ... In full scipy there are typemaps for numpy arrays in ... Typemaps can be a little confusing at first, but they do make your interface a bit nicer. ...
    (comp.lang.python)
  • Re: Need Help declaring parameter variables for DllImport for c-dl
    ... What you said about the nSize and nLength makes a lot of sense. ... right about the pointer to the encoded data pointed by a pointer in the Blob ... IntPtr pData = Marshal.AllocHGlobal; ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: fread choking on binary file
    ... pData, rather than into the memory address occupied by pData ... show how the memory for Image.Print.pData is ... I removed it and now the pointer to the buffer is assigned to ...
    (microsoft.public.vc.language)

Loading