pass CString?

I want to pass an array of UINT to another window through postmessage. in
first winodw, dump those data to the string using string.Format. In the next
window, I have to calulate the length and use atoi to get the data. Any
other simpler way of doing this? I got to use the CString object to pass
around, cause sometimes, I have to pass string.

thanks


0
7/9/2004 7:01:31 PM
vc.mfc 33608 articles. 0 followers. Follow

4 Replies
395 Views

Similar Articles

[PageSpeed] 4

sscanf

"Patrick Zou" <patrick_zou@no_spam_hotmail.com> wrote in message
news:OkiWLdeZEHA.2500@TK2MSFTNGP09.phx.gbl...
> I want to pass an array of UINT to another window through postmessage. in
> first winodw, dump those data to the string using string.Format. In the
next
> window, I have to calulate the length and use atoi to get the data. Any
> other simpler way of doing this? I got to use the CString object to pass
> around, cause sometimes, I have to pass string.
>
> thanks
>
>


0
7/9/2004 8:11:28 PM
You could also pass a pointer to the array and make the other handler
responsible for deleting the data when it is done (I.E., can't delete in the
calling routine because you are posting the message so you don't know when
it will actually get handled.

Alternatively you could use SendMessage and wait for the handler to finish
with the data.

Tom

"Patrick Zou" <patrick_zou@no_spam_hotmail.com> wrote in message
news:OOF%23REfZEHA.3228@TK2MSFTNGP12.phx.gbl...
> sscanf
>
> "Patrick Zou" <patrick_zou@no_spam_hotmail.com> wrote in message
> news:OkiWLdeZEHA.2500@TK2MSFTNGP09.phx.gbl...
> > I want to pass an array of UINT to another window through postmessage.
in
> > first winodw, dump those data to the string using string.Format. In the
> next
> > window, I have to calulate the length and use atoi to get the data. Any
> > other simpler way of doing this? I got to use the CString object to pass
> > around, cause sometimes, I have to pass string.
> >
> > thanks
> >
> >
>
>


0
tserface (3860)
7/9/2004 9:12:15 PM
Patrick Zou wrote:

> I want to pass an array of UINT to another window through postmessage. in
> first winodw, dump those data to the string using string.Format. In the next
> window, I have to calulate the length and use atoi to get the data. Any
> other simpler way of doing this? I got to use the CString object to pass
> around, cause sometimes, I have to pass string.
> 
> thanks
> 
> 

Well of course the easy way is to pass a different message when you want 
to pass a UINT array.  If you can't do that then you could declare a 
struct MyMessage

struct MyMessage
{  int type;
    void* ptr;
}

Pass a pointer to one of these with the message, and use the type member 
to indicate what type ptr is pointing at.

-- 
Scott McPhillips [VC++ MVP]

0
scottmcp8856 (490)
7/9/2004 11:04:37 PM
Sounds easy enough. Take a look at my essay on worker threads (even though you are using a
single thread, the PostMessage problems are the same). Allocate the array, PostMessage,
have the recipient delete it.

Sender:

CArray<UINT, UINT> * data = new CArray<UINT, UINT>;

data->SetSize(n);
.... fill in n items, or simply do data->Add(value) to append to the existing array without
explicitly setting the size...

wnd->PostMessage(UWM_HERES_A_UINT_ARRAY, (WPARAM)data);


Receiver:

LRESULT CWhatever::OnUintArray(WPARAM wParam, LPARAM)
    {
     CArray<UINT, UINT> * data = (CArray<UINT, UINT>*) wParam;
     for(int i = 0; i < data->GetSize(); i++)
          ... do something with each element
     delete data;
     return 0;
    }

Note that I did "delete data" not "delete [] data" because although data may appear to you
to be an array, to C++ it is a single object with some unknown internal structure (which
just happens to be an array)

				joe

On Fri, 9 Jul 2004 12:01:31 -0700, "Patrick Zou" <patrick_zou@no_spam_hotmail.com> wrote:

>I want to pass an array of UINT to another window through postmessage. in
>first winodw, dump those data to the string using string.Format. In the next
>window, I have to calulate the length and use atoi to get the data. Any
>other simpler way of doing this? I got to use the CString object to pass
>around, cause sometimes, I have to pass string.
>
>thanks
>

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15974)
7/10/2004 4:27:12 PM
Reply:

Similar Artilces:

Is It Possible To Pass Parameters to A Pass Through Query
My assumption is that's it's not. At work I use ODBC to connect to our oracle database with Access 2003. There are cases where using a pass through query runs much much faster and I then use it in a make table query to make a local table. In access you can use brackets [] to have it ask for input. May I assume there is no way to do anything like that in a pass through query? Create a PassThrough query and use code to assign the SQL to this query filtering it with a parameter, and then run it e.g Dim MyVariable As Integer MyVariable = InputBox("Please select a Number&quo...

How to pass an object from C++
Hello! We have a C# asp.net web application that is using a COM dll We use the tlbimp to be able to use the COM dll from C# asp.net web application The method InitRules shown below is located in the COM dll. It can be seen below the text Original. Method InitRules below is called from C# but we want to pass an object of type Handle_DS in addition to all the other parameters. You can see the modified InitRules below marked Modified Note the object of type Handle_DS is a C++ object that is created from C# asp.net application and pass into the InitRules I have also copied the whole idl fil...

CString question #2
Hi, CString test = "Mystring 5" What member function should be use to get "5"? it doesn't work if I try to find position of " " int pos = Mystring.Find(" "); Thanks help! You meant to type... int pos= test.Find( _T(" ") ); right? On a side note, you should get used to wrapping your characters/strings in the _T() macro so if you ever end up writing UNICODE applications you won't run into problems. Like so... CString test = _T( "Mystring 5" ); char ch= _T('A'); HTH -- ============ Fra...

Pass multiple selected values from list box to table
How do I pass multiple selected values from a list box to a table? I've found code to use the values as criteria in a query but would now like to store the values in a table (at least temporarily) thanks in advance. jack Pass selected values from a list box to a table? I don't really think you want to do this. Can you describe more about what you are trying to accomplish? You just store raw data in a table. You don't store manipulated data in a table. Maybe you need a query to do what you want to do... -- Ryan--- If this information was helpful, please indi...

post CString as message parameter
What is the best way to pass CString as message parameters? For example CString mystring; CMyWindow::PostMessage(MY_MESSAGE, (WPARAM)mystring, (LPARAM)0)? Thanks, John homecurr@yahoo.com wrote: > What is the best way to pass CString as message parameters? For example > > CString mystring; > CMyWindow::PostMessage(MY_MESSAGE, (WPARAM)mystring, (LPARAM)0)? > > Thanks, > > John If your application has the need to do this, I *strongly* recommend you evaluate your design. It poses all kinds of problems, like where and how do you allocate memory? Where and how do ...

100% Passing Guaranteed in All I.T. Exams/Certifications at 1st Attempt Hi Friends, To pass all types of I.T Exams/Certifications with mind blowing results in 1st attempt just visit http://www.itreal
100% Passing Guaranteed in All I.T. Exams/Certifications at 1st Attempt Hi Friends, To pass all types of I.T Exams/Certifications with mind blowing results in 1st attempt just visit http://www.itrealexams.com/ and get real time Q&As, Brain Dumps, Real Exams, Study material, E-Books, Video Exams and Labs for your all type of I.T Certification Exams. ...

IT CertificationzzzZ.....100% GUARANTEED PASS.......!!!@!!!
IT CertificationzzzZ.....100% GUARANTEED PASS.......!!!@!!! Hi guys, If you are serious about your professional career and pass IT Certification exam in first attempt then Visit http://www.FreeExamKing.com and get latest Questions And Answers Dumps for Microsoft, Oracle, Cisco, CompTIA and many more, i have used and found it very helpful. ...

Passing data between forms
Hi I am working on a project someone else started, and he has this code: If STR_FormName = "FMS_ToDo" Then Page47.SetFocus He obviously expects the name of the last form to be here, but it is not. In fact, when I put Option Explicit at the top - this field was undefined. How is this supposed to work? Stapes ...

Passing arguments to procedures
There is something fundamental that I have failed to grasp about passing arguments to procedures. I have a form featuring a set of unbound controls displaying dates and the corresponding days of the week. (For some reason, the long-date format, on my computer, does not include the latter, as the documentation suggests it might, so it has to be separately calculated and displayed.) A default date is displayed in each control, on Form_Open. This can then be manually adjusted by a pair of ‘up’ and ‘down’ buttons associated with each day/date control pair. In the case of the control ‘St...

Pass Parameter to stored procedure in pass thru query
How do I pass a parameter to a stored procedure in a pass thru query? I'd like to enter the parameter in a control on a form and then run the pass thru query and pass the parameter to it. I've tried this, but haven't been successful. Any ideas? Thanks. On Sun, 8 Jul 2007 18:04:26 -0500, "SAC" <sac@somewhere.com> wrote: >How do I pass a parameter to a stored procedure in a pass thru query? > >I'd like to enter the parameter in a control on a form and then run the pass >thru query and pass the parameter to it. > >I've tried this, b...

You will pass all the exams at 1st attempt No more headaches and worry about spending the time and money to attempt another exam again. You will pass all of your exams, every time www.FreeExamKing.com
You will pass all the exams at 1st attempt No more headaches and worry about spending the time and money to attempt another exam again. You will pass all of your exams, every time www.FreeExamKing.com ...

OnInitDialog and passing argument
Hello, I want to use a dialog for three different purpose so every time dialog should come up with a different situation. How can I pass argunment(s) to the OnInitDialog window message of the dialog ? Is it possible? Thanks Smith "JSmith" <jsmithmitra@yahoo.com> wrote in message news:u4ajmu$nEHA.3900@TK2MSFTNGP10.phx.gbl... > Hello, > > I want to use a dialog for three different purpose so every time dialog > should come up with a different situation. How can I pass argunment(s) to > the OnInitDialog window message of the dialog ? > Is it possible? The...

How to pass a parameter to a userform
Hi, I need to both open a useform and pass a parameter to it. How do I do this? I'd like to do the following but the Show method doesn't take this kind of parameter. Userform1.Show(param) Cheers Gromit -- Gromit ------------------------------------------------------------------------ Gromit's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=928 View this thread: http://www.excelforum.com/showthread.php?threadid=320229 Create a public variable in the userform, say called myVar, and then Load Userform1 Userform1.myVar = "SomeValue" ...

Pass/Name not recognized
When I try to get my e-mail through outlook express, I enter my name an my password and both are correct because they work online but i outlook it keeps asking me for my Pass/Name. I currently have sb yahoo dsl. Please respond if you know how to fix this ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com ...

by passing SMTP
Hello, On my e-mail system here we use an external company called " postini " which filters our spam. We keep getting spam. My partner said its because it is comming in VIA smtp or other ways by passing postini. Is there a way to accept e-mail that comes only from the Postini IP Address? Please let me know ASAP. Thanks On your firewall, modify the rules to only allow SMTP connections from Postini. You can work with Postini to obtain a list of the IP's they send from. When using Postini, it's also a common practice to remove all MX records except those entries for...

Passing the id to a function
Hi, I have a CStatic instance as follows: CStatic label1; label1.Create("", WS_CHILD | WS_VISIBLE| SS_BITMAP | SS_NOTIFY, CRect(100+i*(15+32), 100, 60, 60), this, static_id); And I have a corresponding ON_STN_CLICKED(static_id,ThisFunctionClicked); But I am not able to do this for dynamic values for the static_id. For example if I have two CStatic instances, each with a different static_id. But I want to call the same function ThisFunctionClicked for both. But the ThisFunctionClicked needs to know which static_id was invoked in order to make decisions. Can I pa...

Pass variables to Worksheet_SelectionChange
I have the following code which works well as it stands. My problem is that I need to vary the range depending on conditions set in other code. Private Sub Worksheet_SelectionChange(ByVal Target As Range) '----- ENABLE TICKS IN RELEVANT BOXES ----- Application.EnableEvents = False On Error GoTo sub_exit If Not Intersect(Target, Worksheets("Room").Range("P11:T39")) Is Nothing Then With Target If .Value = Chr(252) Then .Value = "" Else .Value = Chr(252) .Font.Nam...

Windows XP install passes the 'press any key...' screen
Hello, I'm trying to re-install windows xp on my machine. I am able to get it to boot from the cd, but when I get to the screen that says 'Press any key...' I press keys on the keyboard but it doesn't recognize that i'm pressing anything and starts windows normally. Any work arounds or solutions? Thanks! Katy -- klau962` undisclosed wrote: > Hello, I'm trying to re-install Windows XP on my machine. I am able to > get it to boot from the cd, but when I get to the screen that says > 'Press any key...', I press keys on the keyboard...

Network Diagram
I'm taking a PM class and our instructor had us manually create a network diagram so that we could learn how the forward pass and backward pass are calculated. He also said that the network diagram in project can be configured to show the calculations as well. For example... 0 10 Days Duration 10 instead of dates. I have figured out how to reflect this in diagram box but cannot get it to add the ten days to the duration on the following box. I created a custom number field with a formula to get it to show what is in the example based on my tasks. Any one know how to g...

passing arrays to VB via EXCEL4 API #3
Jim - Nothing personal - thanks for the response. I guess I'll have to kee searching for an Excel archeologist. Say... maybe this knowledge o antiquities is a marketable skill! Hmm... Thanks again, - Ro -- cell divisio ----------------------------------------------------------------------- cell division's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=1610 View this thread: http://www.excelforum.com/showthread.php?threadid=27553 ...

Noob Question CString to Float conversion
Hey guys - I am having difficulty in converting a CString to a float value to allow me to do calculations with it. Any help would be appreciated. Thanks. try atof() "Rik Irving" <indigoed@btinternet.com> wrote in message news:bpqv0g$qv8$1@titan.btinternet.com... > Hey guys - I am having difficulty in converting a CString to a float value > to allow me to do calculations with it. > > Any help would be appreciated. > > Thanks. > > Rik Irving wrote: > Hey guys - I am having difficulty in converting a CString to a float value > to allow me to ...

Passing field to a report
It doesn't help me on how to pass the accountnumber from CRM to a parameter in the report. This should be possible or ? Perhaps this article on MSDN will help you: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/CrmSdk3_0/htm/v3d0usingparameters.asp "Jack" wrote: > Hi ! > > I have made a report and imported it into CRM. It is not a report taking > data from CRM but from an ERP system. > > The thing is I need to pass accountnumber to the report so that the report > shows data from the ERP system for only this account. > > Right now...

Passing a variable to XSL.
Hello, Can someone explain the easiest way to pass an external value to an XSL file? If I have a variable within my ASP file called "ClickArea", can I send the value to my XSL file? I believe I need to use Addparameter somehow, but I have no joy. If someone could post a super quick very basic example of how Addparameter works (VBScript ASP), I can take it from there! :) The Microsoft example seems to generate code errors. Reegards, Gary. Gary Whittle wrote: > Can someone explain the easiest way to pass an external value to an XSL > file? > If I have a variable ...

Splashscreen by-pass
I installed Excel 2003 on my new computer - I cannot remember how to by pass the 'splash screen' when opening the program. I believe an "-e" is needed somewhere - I cannot remember where. MY OS in Win XP Home SP2 TIA Bill I had to put -turbo after the last " on my Netscape shortcut. Like this "C:\Program Files\Netscape\Netscape Browser\netscape.exe" -turbo Hey it's worth a try...nothing to loose Bobby On Sun, 3 Jul 2005 19:52:18 -0400, "Bill" <smile@here.com> wrote: >I installed Excel 2003 on m...

Keep CString from new()
I've read some papers from vcdj and msj that conclude CString is a wrapper class of string and acts like value type. But some dev resources such as codeproject and this groups contain some samples show "new CString(...)", especially when postmessage function involved. That's misleading. So is below code solid? UINT ThreadRun(LPVOID pParam) { CStringList LineList; ... for(POSITION pos = LineList.GetHeadPosition(); pos != NULL; LineList.GetNext(pos)) { ::PostMessage(hWnd, WM_USER_FILECOMPLETE, 0, (LPARAM)&LineList.GetAt(pos)); } return 0; } void CPageRun::OnFi...