|
And what is the problem with global/class_member variables?
You can use them along your class, or between classes, without a problem.
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
|
|
|
|
|
It's true pal. But if I change my code now it can be a real mess for me. Because I have to change lots of coding parts in my code.
I appreciate your help all the time...
Eranga
|
|
|
|
|
I don't think it's so difficult. Just declaring the variables which you want to access from multiple functions globally will do all the magic for you. That's the reason why global variables exist.
Do remember that global and static variables can be bad if you use them carelessly.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->ßRÅhmmÃ<-·´¯`·.
|
|
|
|
|
Declare the variables at the header, initialize them in the constructor and use "search and replace" to change the names is a lot of work?
What do u prefer? Do that "lot" of work now? Or having scope/access problems in every thing you code afterwards?
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
|
|
|
|
|
Now actually I have no idea what to do...
Here is a one function I've used.
<br />
void CSRFDBDlg::GetMess(int length, char * buffer, ADODB::_RecordsetPtr pRecSet)<br />
{<br />
UpdateData(TRUE); <br />
<br />
_variant_t vtData;
long nRetLength = 0;
<br />
_variant_t vAppendChunck = BinaryToVariant((BYTE*)buffer, length, nRetLength);<br />
pRecSet->Fields->GetItem("Bio_Data")->AppendChunk(vAppendChunck);<br />
<br />
vtData.vt = VT_I2;<br />
vtData.iVal = (int)nRetLength;<br />
pRecSet->Fields->GetItem("Bio_Size")->PutValue(vtData);<br />
}<br />
Here I have two values to store in the database.
I appreciate your help all the time...
Eranga
|
|
|
|
|
I don't understand why can't you use global variables.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->ßRÅhmmÃ<-·´¯`·.
|
|
|
|
|
Ok, here is a real scenario may that why I have use this. Mainly I've read a file and find different data from it, on different functions. On the same function I store them in a database. That mean I've store data on the database in different places(ie: on different functions).
What I want to do is, store all the data on a single function. I think it is clear to me, when I look at the code. May be I can use those codes later.
I appreciate your help all the time...
Eranga
|
|
|
|
|
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
|
|
|
|