15,915,019 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by lrinish (Top 3 by date)
lrinish
28-Sep-13 22:48pm
View
I guess I should have tried this before I responded. It just made sense so I thought it would solve the issue but device is still NULL after the caller returns. Like mentioned I have no trouble returning "WebCamDevice*" but when I pass it back it gets lost. I tried two more methods passing by pointer (no pointer to pointer) and by reference. Passing by pointer ends with a NULL value and passing by reference returns with an uninitialized object. Its almost acting like its passing the parameter by value.
lrinish
28-Sep-13 22:10pm
View
Deleted
Spoke to soon this is still not working. Device is getting set properly but its just not being passed back to the caller. I changed it to the code below but still no dice. I can change the code to return "device" just fine but I'm really trying to understand why this doesn't work.
<pre>
WebCamDevice* device = NULL;
deviceList->GetDevice(index, device);
//device is still NULL.
HRESULT WebCamDeviceList::GetDevice(size_t index, WebCamDevice* device) {
HRESULT hr = S_OK;
if (index < _DeviceList.size()) {
device = _DeviceList[index];
}
//device is not null at this point
return hr;
}</pre>
lrinish
28-Sep-13 19:10pm
View
Thank you pasztorpisti for your help. I made this work by returning the WebCamDevice* before I made this post but this code is not even close to finished and I will be changing the hr value.
I understand that WebCamDevice** is a bad habit. I do this more for a visual clue to myself that this parameter is an output variable and that I'm changing what WebCamDevice* is pointing at. Probably not the best practice but like I said I'm relearning this stuff.