|
Does your DLL and your colleague's DLL compare the same? If not, then they are somehow being built differently.
"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
|
|
|
|
|
We didn't compare when both was working. Now, when my build did not register, we compared, and the size is about 4k diff but we can not figure out why. We've compared every possible setting/system DLL that we can think of...
|
|
|
|
|
tieng86 wrote: but we can not figure out why
Different Platform SDKs?
|
|
|
|
|
Have you tried the GetLastWin32Error to see exaclty where it is hanging up?
_____________________________________________
Flea Market! It's just like...it's just like...A MINI-MALL!
|
|
|
|
|
Thanks for your sugestion but how would I use the API since the dll is registered after the DLL is built successfully or manually registered on a command line outside of code? Also is this API avail in VC++ 6.0? I did some searching but did not find the help for it.
|
|
|
|
|
|
Hi,
I am using a tree control in a simple GUI.
I responded to a right click on the control and popped up a context menu for it, so far so good.
Next, I want to know which is the HTREEITEM that was selected, so I can do something with it.
The problem is this will work only if the item was first selected by a left click first and then the right click.
If I select an item by docuble click so it will open all of it's sub items and then right click on one of the sub items, the GetSelectedItem function will return me the root item and not the one I right clicked on.
any solution ?
Here are my right click and menu handling functions:
<br />
void Cfbe_sim_guiDlg::OnNMRclickSystemTree(NMHDR *pNMHDR, LRESULT *pResult)<br />
{<br />
DWORD dwPos=::GetMessagePos();<br />
CPoint point((int)LOWORD(dwPos),(int)HIWORD(dwPos));
<br />
CMenu menu;<br />
menu.LoadMenu(IDR_MENU1);<br />
CMenu *pContextMenu=menu.GetSubMenu(0);<br />
<br />
pContextMenu->TrackPopupMenu(TPM_LEFTALIGN|TPM_LEFTBUTTON|TPM_RIGHTBUTTON,<br />
point.x,point.y,AfxGetMainWnd(),<br />
NULL);<br />
<br />
<br />
*pResult = 0;<br />
}<br />
<br />
void Cfbe_sim_guiDlg::OnTreeObjectproperties()<br />
{<br />
<br />
HTREEITEM selected_item = m_ctl_system_tree.GetSelectedItem();<br />
<br />
<br />
CString item_text = m_ctl_system_tree.GetItemText (selected_item); <br />
.<br />
.<br />
.<br />
}<br />
|
|
|
|
|
That's by design.
If you want to select the node the cursor is over then you need to do it manually.
Something like this maybe...
POINT ClientCursPoint, ScreenCursPoint;
::GetCursorPos(&ScreenCursPoint);
ClientCursPoint = ScreenCursPoint;
::ScreenToClient(m_ctl_system_tree, &ClientCursPoint);
TVHITTESTINFO HTInfo;
HTInfo.pt = ClientCursPoint;
HTREEITEM hItem = TreeView_HitTest(m_ctl_system_tree, &HTInfo);
if (hItem)
{
...
TreeView_SelectItem(m_ctl_system_tree, hItem);
}
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
excellent !
that did the trick,
Thanks a lot
|
|
|
|
|
how i can monitor the top processes running in a windows machine from remote .
ie ....i need to make a remote task manager for windows ...Can anybody help
vineesh
|
|
|
|
|
why not remote desktop in the pc and look at the running process that way?
if you want to develop it yourself you will either need to know tcp/ip or use DCOM to make your task manager
GL
Yours Truly, The One and Only!
|
|
|
|
|
Hi All,
I have on basic doubt.
In windows environment both BSTR and LPWSTR are typedef ed to unsigned short *.
But the contents in that pointer are different. BSTR is a wide char string with length in the first byte. LPWSTR is a null terminated string.
But,
<br />
CString str;<br />
LPWSTR lpw = L"lpwstr";<br />
BSTR bst = AllocSysString("bstr");<br />
str = lpw;
str = bsw;
The code works fine, and behaves as we expect.
My doubt is how at run time the decision on the first byte is decided? i.e whether the first byte is the data or the length?? how the compiler identifies.
Thanks and regards,
Raja Pratap
|
|
|
|
|
Raj Prathap wrote: But the contents in that pointer are different. BSTR is a wide char string with length in the first byte.
Actually the length field is 4 bytes long.
Raj Prathap wrote: BSTR bst = AllocSysString("bstr");
The above should be:
BSTR bst = SysAllocString(L"bstr");
Raj Prathap wrote: The code works fine, and behaves as we expect.
My doubt is how at run time the decision on the first byte is decided? i.e whether the first byte is the data or the length?? how the compiler identifies
The trick is in SysAllocString that returs a pointer to the data string, not to the length prefix, see here http://msdn2.microsoft.com/en-us/library/ms221069.aspx[^] for a better explanation.
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.
|
|
|
|
|
Thanks. The link provided is really helpful.
I was not clear about the parts of the BSTR i.e length+data+terminator. I used think terminator would not be there since the length is already there. Any ways with the link to MSDN article, all doubts are cleared. Thanks a ton.
/pratap
|
|
|
|
|
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: ^_^
|
|
|
|