|
Hello all,
I am a newbie. I want to know how can I return a structure variable from a function to the calling function.
I have a structure named httpsData which contains following fields:
typedef struct
{
char httpServerName[25];
char httpReqHeaders[255];
char httpVerb[5];
char httpRetHeaders[255];
char httpRetMessage[2048];
}httpsData;
I want to return a variable of type httpsdata. Can I use httpsData as function return type ?
Thanks for your prompt answer.
Nikhs
Nikhil Trivedi
|
|
|
|
|
Nikhil Trivedi wrote: Can I use httpsData as function return type
Sure you can use.
struct httpsData _MyFunction(Param1,...)
will do, but this is returing the struct as value type
Do your Duty and Don't expect the Result
|
|
|
|
|
Nikhil Trivedi wrote: I want to return a variable of type httpsdata. Can I use httpsData as function return type ?
Pass httpsdata as a reference... this helps you to return an execution status value too, which won't be possible if you are returning a structure.
int GetHTTPSData( httpsdata& httpsData_o )
{
httpsData_o = anotherHttpsData;
return 0;
}
|
|
|
|
|
Nibu babu thomas wrote: Pass httpsdata as a reference... this helps you return a execution status value too, which won't be possible
After execution of the function, Can I access the elements which are modified during the function execution. If so how ?
Thanks for your reply.
Nikhs
Nikhil Trivedi
|
|
|
|
|
Like this,
struct __dummy {
int i;
int j;
}Dummy;
bool LoadValues(struct Dummy& src)
{
src.i = 1;
src.j = 2;
return true/false;
}
void SumFns(..)
{
struct Dummy MyDummyValue = {0};
if (LoadValues(MyDummyValue))
{
int a = MyDummyValue.i;
int b = MyDummyValue.j;
}
else
}
Do your Duty and Don't expect the Result
|
|
|
|
|
Thanks to both of you, friends. This really helped me a lot.
Thanks again
Nikhs
Nikhil Trivedi
|
|
|
|
|
Hello dear friend,
I am successful in calling the function with passing values as reference but when I access the values in calling application which is out side of the c++ environement, I am getting those as NULL.
Can you tell me the reason.
Nikhs
Nikhil Trivedi
|
|
|
|
|
the short answer: yes
the long answer:
have u tried it ? The process of learning coding requires a lot of trial and error. You should have tried it to see if it works before asking such question.
|
|
|
|
|
Is this the same problem as your question from yesterday[^] ?
If yes, from where do you want to use this dll ? If it is not from a C++ program, then you'll need to pay extra consideration about converting the strings. For example if you use it in VB, the conversion is not trivial (as far as I remember).
|
|
|
|
|
Cedric Moonen wrote: Is this the same problem as your question from yesterday[^] ?
Yes. It is the same problem. I want to modify my DLL and i would be using this DLL out of the C++ environment. This environment is also built up in C++. So I think It should work. I am trying to do so. Hope it would work.
Thanks for your concern.
Nikhs
Nikhil Trivedi
|
|
|
|
|
how to add a Vertical Scrollbar to an existing multi-document application.
Shanky
|
|
|
|
|
Hi.
Is it possible to combine openGL and GUI interface in one window? If it is possible, how do I go about doing it in SDI? But if it is not possible, is there any idea that I could use to create an application which is as follows: For the GUI part, I want to have three picture control to display three graph, say, on the right hand side of the window. And for the openGL part, I want to display a 3D model (on the left hand side of the window) using the data from the three graph.
Any idea is really appreciated. Thank you.
|
|
|
|
|
It's very possible. Basically you just create your application like you would a normal windows app, then add an opengl window to it.
Check out this forum: http://www.codeproject.com/opengl[^]
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
For instance:
I want to implic the function :When i Rbuttondown the dialog,there is a pop-up menu.if the pop-up menu caption is "stretch",it can change to "shrink" when clicked.
Thx advance!
Where did the good times go?
Don't try it, just do it!
*Archibald*rever dragon!
|
|
|
|
|
In MFC you can use ModifyMenu (or SetMenuItemInfo for Win32 api):
ModifyMenu( MF_BYPOSITION, MF_STRING, indexOfYourMenuItem, "shrink" );
ModifyMenu( MF_BYCOMMAND, MF_STRING, ID_YOURMENUITEM, "shrink" );
See here for more info: http://msdn2.microsoft.com/en-us/library/89c2aa4b(VS.80).aspx[^]
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Does anyone know of some example code (C++) to enable extraction of keys from a PKCS12 file into memory. This will then be used to digitally sign an XML document etc...
|
|
|
|
|
Since dealing with PKCS involves using many of cryptographic promitives, you should look into some crypto libraries. OpenSSL has an application, PKCS12 (download their archive and look at apps/pkcs12.c) that deals with PKCS#12 storage.
Look here ("Parsing PKCS#12 files"):
http://www.drh-consultancy.demon.co.uk/pkcs12usg.html
On your place I'd retro-engineer the pkcs12.c to see how the command line in that section works.
Hope it helps,
- Dmitry.
-------------------------
Don't worry, be happy ![Blush | :O](https://codeproject.freetls.fastly.net/script/Forums/Images/smiley_redface.gif) )
|
|
|
|
|
Thanks, very appreciated. I have downloaded the source and will investigate it.
|
|
|
|
|
Hello all,
I feel a little bit stupid by asking this, but I've run out of ideas...
I'm trying to register and use an OCX control.
The steps that I'm following are this ones:
1. from a DOS window: regsvr32 ocxname.ocx
2. Once I receive the message saying that the control has been registered I start the Visual C++6.
A)
3. PROJECT -> ADD TO PROJECT -> COMPONENTS AND CONTROLS -> REGISTERED ACTIVEX CONTROLS -> ocxname.ocx.
Once I click on the just registered OCX control, I receive the message:
---------------------------
Microsoft Visual C++
---------------------------
C:\krc\LIB\Cross.ocx
Unable to open this ActiveX Control. Make sure the control contains a valid type library.
---------------------------
OK
---------------------------
B)
3. Right click on the dialog I want to use that OCX, select insert activex control (and select the just registered OCX control).
This inserts an icon of the OCX in the dialog, and if I go to the class wizard I can see that the control ID has been added, but I cannot add a new variable for that OCX, if I try to add a new variable for that OCX, I get this message:
---------------------------
Microsoft Visual C++
---------------------------
The ActiveX Control "KUKA-Cross-OCX" has not been inserted into the project. Developer Studio will do this now and generate a C++ wrapper class for it.
---------------------------
OK Cancel
---------------------------
When I select OK, then this message appears:
---------------------------
Microsoft Visual C++
---------------------------
The ActiveX Control is not registered properly, or its type library version number is incorrect.
Try registering the control by removing and importing it in the Component Gallery.
---------------------------
OK
---------------------------
I'm lost, I don't know why do that ActiveX control don't want to get registered properly on my system. And moreover I cannot get support information from the manufacturer...
Could you give me any idea on that?
As always, thank you in advance.
|
|
|
|
|
Seems to be something wrong with the typelib.
Open the ocx-file with OLE/VIEW to verify that it contains a typelib.
If it does, have a look in the registry at the following:
Locate the ProgID of the ActiveX below HKCR to get hold of the CLSID.
Locate the CLSID below HKCR\CLSID. Below that key there should be a 'TypeLib' key with the GUID for the typelib as default value.
Locate that GUID below the HKCR\TypeLib path. Below it you should have at least one key that corresponds to the typelib version of the control. Below that key you should have at least one key that corresponds to the language used by the control, the LANGID where zero means "language neutral" and is usually the only one present. Below that key you should find a 'win32' key where the default value is the path to the file that contains the actual typelib, usually the ocx-file.
Verify that the file is present at the designated location. You could correct it if it's erroneous.
If the information above doesn't exist, try and deregister the control with "regsvr32 /u ocxname.ocx" and verify that all keys are deleted.
Register it again and verify that the keys are written.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Wow Roger!
That has been a complete answer!
Well I've tried that, I've opened the OLE Viewer and then I selected the first option in the menu in which you can view the type library. Then I've selected the ocxname.ocx control.
Once I've done that a messagebox appeared a couple of times telling me:
---------------------------
OLEViewer 2.0 Interface Viewers
---------------------------
Could not decompile selected item
<no system="" message="" defined=""> TYPE_E_CANTLOADLIBRARY ($80029C4A)
---------------------------
OK
---------------------------
Do you know if this is a problem? and if it is one, do you know if it has any solution?
Thank you in advance for your time and help.
|
|
|
|
|
It looks to me as if the ocx-file doesn't contain a typelib, or the file is corrupt.
Did you by any chance get other files with this ocx-file, like *.tlb or *.olb files?
If you didn't, it means that you don't have the typelib for the ActiveX control and you probably should contact the support department of the supplier.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
I've found a .tlb file but it has not the same name of the ocx control.
Do you think that this can be a problem?
Can I import a TLB file?
Thank you in advance!
|
|
|
|
|
Joan Murt wrote: I've found a .tlb file but it has not the same name of the ocx control.
Open it with OLE/VIEW and have a look.
See if it could be the typelib for the ActiveX control.
What does it say? What's the name of it?
Is the ActiveX control part of a larger package?
Joan Murt wrote: Can I import a TLB file?
Absolutely.
But you'd better select the right one.
If you f.ex. choose to run office application through automation, you #import .tlb and .olb files.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
I have a program that graphs data from a device on the fly. To update the graph every second I call the InvalidateRect function. When the program runs for a while (e.g 1 hour) it's fine, but when I run it over night and come back in the morning to check it, the whole computer monitor is white. I then minimize my program (when I scroll over the buttons on the taskbar they start to appear) and everything is back to normal. It seems the InvalidateRect function messes up my refresh rate or it some how invalidates the whole screen even though i specified a small rect on the window. Anyone know how I can solve this?
------------------------
Impossible is Nothing
|
|
|
|