|
What exactly do you mean when you say you wish to use the other functions from a single function?
|
|
|
|
|
Seems to me, my explanation is not clear of the question. Please look at the replay for baerten.
I appreciate your help all the time...
Eranga
|
|
|
|
|
typedef struct tagRET_VAL
{
int code;
void* pValue;
}RET_VAL, *PRETVAL;
enum CODE{ CODE_INT, CODE_STRING };
void fun1()
{
int a = 10;
RET_VAL rv;
rv.code = CODE_INT;
rv.pValue = &a;
return &rv;
}
void fun2()
{
char s[] = "hello";
RET_VAL rv;
rv.code = CODE_STRING;
rv.pValue = s;
return &rv;
}
void GetValue( PRET_VAL pRV )
{
switch( pRV->code )
{
case CODE_INT:
// do something with (int *)pRV->pValue ....
break;
case CODE_STRING:
// do something with (char *)pRV->pValue ...
break;
}
}
|
|
|
|
|
|
I do it like this:
<br />
_variant_t Bookmark=m_pRS->Bookmark;<br />
m_pRS->Bookmark=Bookmark
However, in some case an error will occur in the statement:
<br />
_variant_t Bookmark=m_pRS->Bookmark;<br />
I used try-catch, it's an unknown error.
What I want to do is to remeber the current position for back.
Is there an efficient way?
And How to make my recordset support bookmark?
Thanks very much.
-- modified at 4:28 Monday 12th November, 2007
|
|
|
|
|
I have an visual c++6.0 dll workspace, that I would like to compile as a lib. Is it necessary to create a new dsp, or may I screw the settings of the dll dsp so that it can compile as a static lib ?
And yes, I do feel ashamed to still have to ask such basic questions
Thanks,
RaGE
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
Do not feed the troll ! - Common proverb
|
|
|
|
|
In the procect-explorer, you choose your project and click on properties.
or in the main-menu on project -> <your_projectname> settings
There'in you have the possibility to choose the kind of "output" DLL,LIB or EXE.
Then you choose LIB. You find this page at "configuration-properties"
I hope it works
BTW: my visual studio is in german, so i don't know the exact names of the menu-elements
|
|
|
|
|
baerten wrote: There'in you have the possibility to choose the kind of "output" DLL,LIB or EXE.
In which tab is this exactely ( Did you notice Visual C++6.0) ?
baerten wrote: my visual studio is in german, so i don't know the exact names of the menu-elements
Mine too
~RaGE();
I think words like 'destiny' are a way of trying to find order where none exists. - Christian Graus
Do not feed the troll ! - Common proverb
|
|
|
|
|
Projekt -> Einstellungen (ALT+F7) (Benutzer definiertes)
But actually I think you should do nothing. The compilation already gives you the *.dll, *.lib and *.def
You choose what you want to use, when integrating the dll in other projekt. Static or dinamic
BTW, have your tried "Erstellen -> Alles neu erstellen...?"
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Ah sch***, zu flott gelesen, sorry.
Ist super lange her das ich Visual C++ 6.0 genutzt habe, aber das muss auch in den
Projekt-Einstellungen zu finden sein. Denn das erstellen einer .lib oder .dll ist ein
fundamentales Kriterium das auch schon Version 6.0 ermöglichen sollte.
Leider habe ich kein 6.0 installiert, sonst würde ich mal nachsehen wo sich dieser Menüpunkt verstecken könnte...
Aber Nelek könnte schon die Lösung haben
Viel Glück
|
|
|
|
|
The menu option you told was right. I think is in the "Linker" tab, there are two fields that say:
Name der Ausgabedatei: Release/MyDll.dll
Objekt-/Bibliothek-Module: (for me is empty)
But as I said, when I compile I have all the files in the debug/release folder. The *.dll, *.lib and the *.exp
So I guess not much work is needed.
In the worst case, create a new dll project. Open the *.cpp, *.h and *.def files. Copy/paste the code into the created project and compile.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
|
|
|
|
|
Hello everyone,
Are there any official site to check whether an API (like tolower or toLower) is platform specific API (e.g. Microsoft platform specific, Linux specific) or C common standard API?
thanks in advance,
George
|
|
|
|
|
You need a copy of the ANSI C standard ISO/IEC 9899:1999 to see if a C Library function like tolower is in the standard. ( A draft is on the web but you're supposed to buy it )
You need to check the MSDN documentation for any standard API to see if Microsoft implemented it and glibc at www.gu.org is usually the place to look to see if Linux supports it. Not all in all an easy task. If you want to know more you could email me.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Thanks Matthew,
I have found it.
regards,
George
|
|
|
|
|
When using MSDN you'd typically see a "Requirements" section where compatibility information is given. If an API is part of the ANSI standard then it puts the text "ANSI" in the "Compatibility" column. See here[^].
|
|
|
|
|
Thanks gleat,
You are so cool.
regards,
George
|
|
|
|
|
Hi all,
I've create a ADO connection to connect a SQL database to my application as follows.
<br />
ADODB::_ConnectionPtr pConn;<br />
ADODB::_RecordsetPtr pRecSet;<br />
<br />
GetADOCon( srf_SQL, pConn, pRecSet );<br />
sqlStr.Format( "SELECT * FROM RecordData" );<br />
hr = pRecSet->Open( _bstr_t(sqlStr), pConn.GetInterfacePtr(), ADODB::adOpenDynamic, ADODB::adLockOptimistic, -1);<br />
It works fine on my application. But I want to avoid future issues that opening the database/dataset and check it is exist or not.
How can I do that.
Can I use SUCCEED to assert my application.
Thanks.
I appreciate your help all the time...
Eranga
|
|
|
|
|
I've done it simply as follows.
<br />
if (FAILED(hr))<br />
{<br />
AfxMessageBox( "Open Database connection Failed." );<br />
}<br />
How far this way is efficient to use.
I appreciate your help all the time...
Eranga
|
|
|
|
|
From the code snippet you posted earlier I gather that you are using #import to import the ADO type declarations. Depending on what attributes you used while writing your #import statement the HRESULT s returned by COM methods might be swallowed by the wrapper class that the compiler generates for you (in the ".tli" file) and get translated into C++ exceptions throwing _com_error objects. So you might want to handle that exception.
|
|
|
|
|
Of course, yes. I've already wrote few classes to handle that exception.
Actually that my question is part of a error handling class.
I appreciate your help all the time...
Eranga
|
|
|
|
|
Hi,
I have a Pdf file which I want to run from my Application.
I want to restrict copy access to a file when I open the file using the my application.
Can I restrict access to that Pdf file by placing a lock on that file? So that only my application accesses it and no one can access the file.Is that a possible Solution?
Any Suggestions would be helpful.
Thanks
Today is a gift, that's why it is called the present.
|
|
|
|
|
narayanagvs wrote: when I open the file using the my application.
Through which API ur opening the file? Another applications, such as explorer cannot copy a file if it is already opened with the share deny ready permission.
Check the "DWORD dwShareMode" parameter in the CreateFile() API.
|
|
|
|
|
narayanagvs wrote: Can I restrict access to that Pdf file by placing a lock on that file? So that only my application accesses it and no one can access the file.Is that a possible Solution?
You mean using a semaphore ? If that's the case, then the answer is no. A semaphore has to be used by all parties that want to access a resource (whatever it might be). So, in all the programs that wants to access the resource, they need to use the same semaphore.
If you lock your file in your application through a semaphore, nothing prevent explorer (for example) to open the file (because it doesn't use a semaphore to open the file).
|
|
|
|
|
Cedric Moonen wrote: You mean using a semaphore ? If that's the case, then the answer is no
If not semaphores, Is there any way to do that?
Thanks
Today is a gift, that's why it is called the present.
|
|
|
|
|
When you open the file, use the exclusive flag. As Cedric said, semaphores have nothing to do with this.
Judy
|
|
|
|