return two hwnds

Posted on 2007-12-04
Last Modified: 2010-04-01
int main ()
HWND handles[2] = return_two_handle();
return 0;

HWND return_two_handle()
HWND handles[2];
  return handles;

this pops up:

.cpp: In function `int main()':
.cpp:57: error: invalid initializer
.cpp: In function `HWND__* sign_in_two()':
.cpp:152: error: cannot convert `HWND__**' to `HWND__*' in return
Question by:Troudeloup
  • 4
  • 2

Author Comment

ID: 20408292
or rather,

how do I return more than one HWND is one function and how do I receive it ?
LVL 55

Expert Comment

by:Jaime Olivares
ID: 20408341
will be better to do this way:

void  return_two_handle(HWND &h1, HWND &h2)
  h1  = ....;
   h2 = ....;

so you can call this way:

HWND handle1, handle2;
return_two_handle(handle1, handle2);

Author Comment

ID: 20408347
just one little detail,

the function would create those two handles and return it.

it's afunction that starts things and then i need those two handles returned to use them elsewhere.
Live: Real-Time Solutions, Start Here

Receive instant 1:1 support from technology experts, using our real-time conversation and whiteboard interface. Your first 5 minutes are always free.

LVL 55

Accepted Solution

Jaime Olivares earned 500 total points
ID: 20408374
no problem with my suggestion

Author Comment

ID: 20408388
ohhh i get it, you pass it be reference to the function and so no return is required

got it :)

Author Comment

ID: 20408412
would you take a look of the lastest two posts of this?

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: SunnyDark
This article's goal is to present you with an easy to use XML wrapper for C++ and also present some interesting techniques that you might use with MS C++. The reason I built this class is to ease the pain of using XML files with C++, since there is…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

776 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question