473,394 Members | 1,140 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 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 12599
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.