|
You are welcome
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Raj Prathap wrote: whether the first byte is the data or the length??
Starting address of a BSTR variable always points to real data that is the character string and length is stored at an offset minus starting address of a BSTR variable.
For eg:
BSTR bstrLengthTest = ::SysAllocString( L"Nibu" );
DWORD dwLength = *(DWORD*)((DWORD)bstrLengthTest-sizeof(DWORD));
cout << endl<< "String length in bytes is: " << dwLength << endl;
Hence BSTR always works both ways but an LCWSTR won't always work both ways.
|
|
|
|
|
Raj Prathap wrote: how the compiler identifies.
It doesn't the code tells it (declares) what the types are.
as in the following "declarations":
LPWSTR lpw<br />
BSTR bst
Also....
Raj Prathap wrote: My doubt is how at run time the decision on the first byte is decided?
Raj Prathap wrote: how the compiler identifies.
The compiler does NOT do ANYTHING at "run time".
|
|
|
|
|
You have to keep track yourself of which strings are BSTR s and which are just C-style strings. It would be nice if the compiler could do that, but the fact that BSTR and LPWSTR are typedef 'd to the same thing makes that impossible.
|
|
|
|
|
Hi,
When I am trying to automate MS Word (32 bit) from a NT Service (32 bit). The word runs as a 64 bit application (as evident from the task manager).
But if the same code is run as a thread from a Windows application word runs as 32 bit.
How can I automate word to run as 32 bit from the NT sevice??
Thanks,
Indra
|
|
|
|
|
Hi all,
I am getting this error "Access violation at address 61102752 in module
'oracore9.dll'. Read of address 00040008." When I run my application in the IDE (debugging). Can anyone please help me? Or tell me why this is happening?
Many Thanks
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
Someone, somewhere is using a pointer to memory he is not supposed to access.
Without Code we can not say too much.
Failure is not an option - it's built right in.
|
|
|
|
|
Use the callstack to locate more precisely the problem. Then you'll be able to set breakpoints before the error occurs and check if everything is as expected.
|
|
|
|
|
Thanks for the reply ...
Firstly this only happens when when I'm using an Oracle database. Secondly my call stack is empty, but the occurance happens in this function call:
SQLRETURN ret;
SQLSMALLINT pcbConnStrOut;
if(drvConn == sqlPrompt && hWnd == NULL)
return FALSE;
if(m_lConnectionTimeout > 0)
SQLSetConnectAttr(m_hDbc, SQL_ATTR_CONNECTION_TIMEOUT, (SQLPOINTER)m_lConnectionTimeout, 0);
SQLSetConnectAttr(m_hDbc, SQL_ATTR_LOGIN_TIMEOUT, (SQLPOINTER)m_lLoginTimeout, 0);
ret = SQLDriverConnect(m_hDbc,
hWnd,
(SQLCHAR*)szConnStr,
SQL_NTS,
(SQLCHAR*)szConnStrOut,
sizeof(szConnStrOut),
&pcbConnStrOut,
(SQLUSMALLINT)drvConn);
m_bIsConnected = ret == SQL_SUCCESS || ret == SQL_SUCCESS_WITH_INFO;
return m_bIsConnected;
When trying the same thing is MySQL everything works. I have no I dea whats going wrong.
Regards,
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
Where does it crashes exactly in this piece of code ? Did you put breakpoints and check if the variables are correct ?
|
|
|
|
|
Variables are correct, because I call the exacpt same function (database class ODBC) a few lines back, without a problem. Please note that this only occurs in the IDE run-time debugging senario. When I compile a .exe and run it, there is no problem with it.
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
Programm3r wrote: ...there is no problem with it...
...that you know of. Problems don't just go away. They can move or be masked, however.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Sorry .. after putting in a try and catch block I received the following:
Stack:
:004B453D CODBCDatabase::DriverConnect(this=:0012E38C, szConnStr=:0055F294, szConnStrOut=NULL, hWnd=NULL, drvConn=0 /* sqlNoPrompt */)
:0040EFD0 getDUCNames()
:60601457 OraClient9.OCIServerAttach + 0x67
:08b0698b OCI.OCIServerAttach + 0x2b
:08aa6f69 ; C:\EC-Apps\OracleClient92\BIN\SQORA32.DLL
:08aa6e09 ; C:\EC-Apps\OracleClient92\BIN\SQORA32.DLL
:08aa97f6 ; C:\EC-Apps\OracleClient92\BIN\SQORA32.DLL
:08aa8c67 ; C:\EC-Apps\OracleClient92\BIN\SQORA32.DLL
:08a942ea ; C:\EC-Apps\OracleClient92\BIN\SQORA32.DLL
:74323079 ; C:\WINDOWS\system32\ODBC32.DLL
:74322fbc ; C:\WINDOWS\system32\ODBC32.DLL
:743528f9 ; C:\WINDOWS\system32\ODBC32.DLL
Occurs here at this call:
if (!pdb.DriverConnect(lpSapDsnStr))
return;
ret = SQLDriverConnect(m_hDbc,
....
Does this give a more descriptive explanation ??
The only programmers that are better that C programmers are those who code in 1's and 0's
Programm3r
My Blog: ^_^
|
|
|
|
|
You should check the documentation. It is probably normal that the function throw an exception if something goes wrong. If a function might throws an exception, you should always catch it.
If the problem doesn't occur in your exe, you should check the different pathes that you are using. Some of them might be wrong.
|
|
|
|
|
|
Hi,
If i declare too many local variables(DWORD, CString, other data type) in a function, would that make my program slow.
Best Regards,
Mushq
Mushtaque Ahmed Nizamani
Software Engineer
Ultimus Pakistan
"English is my second language; please excuse any grammatical or spelling mistakes"
|
|
|
|
|
Depends on what is it doing in the constructor codes of the data type.
Primitive data type should be harmless or at least not noticeable.
If you running out of memory, it would also slow down your program because of resort to virtual memory. (It will slow or crash even for whatever you do I think anyway)
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Depends on the variable and how it is being used.
For example, creating a DWORD and adding to it in a loop is has significantly different performance implications than adding to a CString in the same loop.
I believe it boils down more to not how many variables you have, but how you are using them. Variables that manage resources for you (like CString ) are easy to use incorrectly (or at least inefficiently).
Peace!
-=- James Please rate this message - let me know if I helped or not!<HR> If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! See DeleteFXPFiles
|
|
|
|
|
This Question is a typical case of "premature optimisation".
Code your program.
If its too slow determine why. A profiler would be helpful here.
Fix *that* issue.
Failure is not an option - it's built right in.
|
|
|
|
|
Technically, yes. Would you notice it? Probably not.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi to all,
if i type the item in the edit box mean it must add into the listbox.
plz gve me ideas.
|
|
|
|
|
estherpappa wrote: if i type the item in the edit box mean it must add into the listbox.
Do you mean to say that as you are typing the text in the edit box, the changes should be reflected in the list box too?
Or you mean - that once you have finished typing the text in the edit box and do some action, then only the string should be added to the list box.
If you want this then you should have a look at CListBox::SetItemText()
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
|
If you are using MFC:
CString strText;
m_edit.GetWindowText(strText);
m_listbox.AddString(strText); If not, a Win32 example can also be provided.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|