472,954 Members | 1,609 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,954 software developers and data experts.

Passing and converting LPVOID

Hi. I'm a beginner to C++ so bear with me. I'm trying to pass a
character array to a new thread so I thought I could pass the pointer
to the character array and cast it as a LPVOID (I know nothing about
LPVOIDs by the way). So I currently have:

AfxBeginThread(myThread,(LPVOID) *myBuffer);

My method myThread looks like:

UINT myThread(LPVOID LParam) {
....[code]...
char* sendBuffer = (char*)LParam;
....[code]...
}

But sendBuffer doesn't point to myBuffer. Any suggestions? Sorry I
can't describe the problem better - I hope you know what I want to do.
But thanks for the help!

Jul 23 '05 #1
2 12494
greyham wrote:
Hi. I'm a beginner to C++ so bear with me. I'm trying to pass a
character array to a new thread so I thought I could pass the pointer
to the character array and cast it as a LPVOID (I know nothing about
LPVOIDs by the way). So I currently have:

AfxBeginThread(myThread,(LPVOID) *myBuffer); ^
Drop the asterisk here.
My method myThread looks like:

UINT myThread(LPVOID LParam) {
...[code]...
char* sendBuffer = (char*)LParam;
...[code]...
}

But sendBuffer doesn't point to myBuffer. Any suggestions? Sorry I
can't describe the problem better - I hope you know what I want to do.
But thanks for the help!

V
Jul 23 '05 #2
Thanks!! Works great!

Jul 23 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

58
by: jr | last post by:
Sorry for this very dumb question, but I've clearly got a long way to go! Can someone please help me pass an array into a function. Here's a starting point. void TheMainFunc() { // Body of...
2
by: Bonj | last post by:
hello I've got a C DLL that I've built which has got a callback function. Now I want to call it from C#. The method of using a delegate for the callback function works absolutely beautifully....
1
by: LongBow | last post by:
Hello, I am attempting to create an application that uses an existing driver interface API using C#. I have an API that looks like F32x_Read( HANDLE Handle, LPVOID Buffer, DWORD...
7
by: Russell Mangel | last post by:
I have been doing some C++ Interop using the new VS2005 (June Beta). I am exposing these methods to .NET clients. I ran into some WinAPI methods which use LPVOID types, and I don't understand...
7
by: Toni | last post by:
Hello Everyone , I'm trying to convert an LPCSTR to LPVOID for use in DeviceIOControl. But when i use LPVOID test = (LPVOID)test_lpcstr then it doesn't work , When i use LPVOID test = "TEST" ,...
5
RedSon
by: RedSon | last post by:
Hi all, HANDLE hnd = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE)ThreadProc, (LPVOID)handleArray, 0, &dwThread); ... DWORD ThreadProc(LPVOID lpParameter) {
1
by: danmilkman | last post by:
Hi Y'all Can someone help me convert the next few lines of code from c++ to c#? I've given it a try myself but my program keeps crashing when I use my c# code. I think the difficulty lies in...
7
by: Young | last post by:
This makes me very puzzled and angry.Please have a look at : ....... ....... _hSelf=::CreateWindowEx( WS_EX_ACCEPTFILES, (LPCWSTR)_className,\ (LPCWSTR)"Web Studio 2008",\...
8
by: asit | last post by:
How do I pass parameters to created thread..here is the code(but it can't pass data..it uses global variable) #include <windows.h> #include <stdio.h> DWORD Sum; DWORD WINAPI...
0
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
0
by: Aliciasmith | last post by:
In an age dominated by smartphones, having a mobile app for your business is no longer an option; it's a necessity. Whether you're a startup or an established enterprise, finding the right mobile app...
0
tracyyun
by: tracyyun | last post by:
Hello everyone, I have a question and would like some advice on network connectivity. I have one computer connected to my router via WiFi, but I have two other computers that I want to be able to...
3
NeoPa
by: NeoPa | last post by:
Introduction For this article I'll be using a very simple database which has Form (clsForm) & Report (clsReport) classes that simply handle making the calling Form invisible until the Form, or all...
1
by: Teri B | last post by:
Hi, I have created a sub-form Roles. In my course form the user selects the roles assigned to the course. 0ne-to-many. One course many roles. Then I created a report based on the Course form and...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 1 Nov 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM) Please note that the UK and Europe revert to winter time on...
3
by: nia12 | last post by:
Hi there, I am very new to Access so apologies if any of this is obvious/not clear. I am creating a data collection tool for health care employees to complete. It consists of a number of...
0
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
1
by: GKJR | last post by:
Does anyone have a recommendation to build a standalone application to replace an Access database? I have my bookkeeping software I developed in Access that I would like to make available to other...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.