Solved

return two hwnds

Posted on 2007-12-04
6
185 Views
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
0
Comment
Question by:Troudeloup
  • 4
  • 2
6 Comments
 

Author Comment

by:Troudeloup
ID: 20408292
or rather,

how do I return more than one HWND is one function and how do I receive it ?
0
 
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);
0
 

Author Comment

by:Troudeloup
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.
0
Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 55

Accepted Solution

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

Author Comment

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

got it :)
0
 

Author Comment

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

http://www.experts-exchange.com/Programming/Languages/CPP/Q_22983831.html
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Errors will happen. It is a fact of life for the programmer. How and when errors are detected have a great impact on quality and cost of a product. It is better to detect errors at compile time, when possible and practical. Errors that make their wa…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…
The viewer will learn how to user default arguments when defining functions. This method of defining functions will be contrasted with the non-default-argument of defining functions.

706 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now