|
|
Hi,
in my application was having double space after the toolbar..
i.e., after file menu, there is more gap to the child window.. where do we usually adjust this height??
thanks,
rakesh
|
|
|
|
|
Could you please stop spamming the forum ? You posted this 1/2 hour ago. And, as a side note, your question is not clear at all. May I suggest you read the posting guidelines before posting again (this is the message at the top of this forum).
|
|
|
|
|
It would be really helpful if you could provide some sort of screen shot exhibiting the problem.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
can u pls tell me how to attach a screen shot while replying??
sorry for troubling u...
rakesh
|
|
|
|
|
Rakesh5 wrote: can u pls tell me how to attach a screen shot while replying??
http://www.flickr.com/[^]
http://tinyurl.com/6krq69[^]
http://imageshack.us/[^]
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hello!
I am using a C51 compiler for a microcontroller (so not visual studio)
I am trying to convert a long int variable to a char*, using C-specific functions (no atoi and the rest)
long Value="1234";
char String[15];
sprintf(String,"%d",Value);
This puts in "String" the value "0".
If I make Value of type integer, it works. What seems to be the problem ?
Are there any (other) functions to help me do this ?
Where can I find the source code for ltoa and the family, to declare it ?
Thanks,
Shpid3r
|
|
|
|
|
try:
sprintf(String,"%ld",Value);
(that's a lowercase "L" - for "long")
|
|
|
|
|
shpid3r wrote: using C-specific functions (no atoi and the rest)
atoi and the rest are all ANSI C functions.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
shpid3r wrote: long Value="1234";
How does this even compile ? You are trying to assign a string (yes, "1234" is actually a string) to a long. You should at least get a warning here...
Try without the double quotes:
long Value = 1234;
|
|
|
|
|
:ashamed of myself:
I didn`t paste the code, just reproduced it here, and in the hurry I put the quotes...
Of course it won`t compile with them
Great, %ld" works!
Thanks! I spent the last 3h trying to figure this out ... I should have asked sooner!
Regards!
Shpid3r
|
|
|
|
|
Just FYI - I'm guessing that (unlike VC++), the C51 compiler has 16-bit ints, which are smaller than longs? And that the C51 is a big-endian chip? WHich would explain the zero result.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi,
in my application was having double space after the toolbar..
i.e., after file menu, there is more gap to the main window.. where do we usually adjust this??
thanks,
rakesh
|
|
|
|
|
Hi,
I have a program that uses a COM object. At somepoint I try to release the object. After I do the release process, I can see using Process Explorer that the ActiveX DLL is still in memory.
My code is below. Am I doing something wrong? Why is the DLL still in memory?
ComReleaseTest.DLL is a test VB ActiveX DLL I wrote to debug this problem. It does nothing - all it has is one test sub which I am not even calling.
<br />
#include "stdafx.h"<br />
<br />
#import "..\ProductTree\winpos\drv32\ComReleaseTest.dll" no_namespace<br />
<br />
_CComReleaseTestPtr m_Srv;<br />
<br />
int Close();<br />
void ReleaseObject();<br />
<br />
int main(int argc, char* argv[])<br />
{<br />
HRESULT hResult;<br />
<br />
try<br />
{ <br />
if ( TRUE )<br />
{<br />
hResult = CoInitialize( NULL );<br />
<br />
if ( hResult != S_OK )<br />
{<br />
return 1;<br />
}<br />
}<br />
<br />
HRESULT hr = m_Srv.CreateInstance(__uuidof( CComReleaseTest ), NULL, CLSCTX_ALL);<br />
if (FAILED(hr))<br />
_com_issue_error(hr);<br />
}<br />
catch(_com_error& e)<br />
{<br />
return (1);<br />
}<br />
<br />
Close();<br />
<br />
return (0);<br />
<br />
}<br />
<br />
int Close()<br />
{<br />
long Result = 0;<br />
<br />
if ( m_Srv != NULL )<br />
{<br />
TRY<br />
{<br />
ReleaseObject();<br />
}<br />
CATCH_ALL(e)<br />
{<br />
TCHAR sError[255];<br />
e->GetErrorMessage(sError,255);<br />
}<br />
END_CATCH_ALL<br />
}<br />
<br />
return ( (short)Result );<br />
}<br />
<br />
<br />
<br />
void ReleaseObject()<br />
{<br />
<br />
try<br />
{<br />
m_Srv.Release();<br />
}<br />
catch(_com_error& e)<br />
{<br />
}<br />
<br />
free(m_Srv);<br />
m_Srv.Detach();<br />
<br />
<br />
m_Srv = NULL;<br />
<br />
}<br />
<br />
<br />
The reason I am trying to track this is that I have anotehr program that at somepoint calls an InstallShield 5.5 setup. This setup.exe hangs at 99% and I found that if my program does not call a certain ActiveX then there is no problem with the setup.exe. So I am trying to release that ActiveX before calling setup.exe, but the COM DLL just stays in memory!
|
|
|
|
|
|
Thank you very much. You are a genius! Problem solved.
|
|
|
|
|
Hi Friends,
I need to add a new item into the context menu we see while we right click on a control panel item and show a message box when user clicks on my item.I just want to display the name of the item on which the user right - clicked in the message box.
Any ideas?
Thanks and regards,
J
|
|
|
|
|
All control panel items are actually DLL files that end with a .CPL extension.
To add a menu item to its context menu, you need to create a shell extension.
Look at this tutorial here - The Complete Idiot's Guide to Writing Shell Extensions - Part I[^]
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Hi,
I am making my application unicode supporting one. i face a problem like this now :
i have got some content in *.inf file..
i am unable to read the content of the file using Readfile(..) function.
code snippet:
-----start-------------
TCHAR * inifilecontents;
HANDLE hFile = CreateFile( iniFilePath,GENERIC_READ,FILE_SHARE_READ,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
if (hFile != INVALID_HANDLE_VALUE)
{
DWORD nfile_Size = GetFileSize(hFile, NULL);
if (nfile_size != INVALID_FILE_SIZE)
{
m_nBufferSize = nFileSize + 1;
iniFileContents = new TCHAR[m_nBufferSize];
ZeroMemory(m_pIniFileContents, m_nBufferSize);
DWORD bytestoread = nFileSize;
DWORD bytesread = 0;
-----> BOOL bReadSucceeded = ReadFile(hFile,inifileContents,bytestoread,bytesread,NULL);
----------End---------------------
after executing readfile funcion, inifilecontents are showing contents as "some small BOXES" and not the exact content of inf file....
please guide me on this...
Thanks,
Rakesh
|
|
|
|
|
May be because your inf file isn't in unicode format. If so you have to read the content as char* itself and then convert it to unicode string using MultiByteToWideChar() function.
|
|
|
|
|
Are you sure that you're compiling for Unicode?
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
Actually i dont have unicode content in the file as of now. but still its not showing even the ASCII content of the file..
when i tried CPallini' suggestion, it showed message box with boxes...
( that was the same thing as i tried earlier..)
Can u enlighten me what can i do for this?
Thanks,
Rakesh
|
|
|
|
|
Well, what do you mean it's not "showing". Where are you trying to show it? An edit control? The debugger watch window? How exactly are you verifying the value of the buffer read?
BTW, this is pointless: m_nBufferSize = nFileSize + 1; Instead of 1 , you must choose sizeof(TCHAR) if you want really neutral code.
[Added] Why are you reading a .inf file with ReadFile() ?!
Shouldn't be using the GetPrivateProfileString()[^] and other similar functions designed for this purpose?
It is a crappy thing, but it's life -^ Carlo Pallini
modified on Wednesday, July 15, 2009 5:58 AM
|
|
|
|
|
Rakesh5 wrote: after executing readfile funcion, inifilecontents are showing contents as "some small BOXES" and not the exact content of inf file....
Actually that's the exact file content. Try to show it with, for instance
MessageBoxW(NULL, (LPCWSTR) inifilecontents, L"TEST", MB_OK);
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.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
In short, using the ReadFile, will read the file content as bytes. Neither as unicode nor as MBCS, but simply as binary data. It is our concern whether it should be treated as unicode or not.
I am ignoring the inconsistency of the variables in your sample code. But still I found a mistake in your code.
That is you are allocating the buffer as 'new TCHAR[m_nBufferSize]'. It is wrong since the GetFileSize will return the exact size of the file in number of bytes. So when you are compiling with unicode enabled, the size of the TCHAR will be 2 (means sizeof unsigned short) and the buffer allocated will be twice of what we needed. Also it should be noted that the data read will not be directly converted to unicode (even if the buffer is of TCHAR).
And, from your question I understand that your file will be in unicode format. If this is true, then you can read it as follows. (modifications might be necessary)
int nSize = GetFileSize(...);
byte* pBytes = new byte[nSize];
ReadFile(..., pBytes, ...);
MessageBox(.., LPCTSTR(pBytes), ... );
This is the case when your file is in binary format.
When you save a file as unicode using notepad, you can see the first two bytes will be FF FE. So when you reading the file you can check that for ensuring the file is unicode and can ignore those bytes from using as data.
Suppose the content of a unicode file is 'abcd', then the binary equalent will be FF FE 61 00 62 00 63 00 64 00. You can see this when you open a file as binary in the VC editor itself.
I hope my explanation is clear for you.
(By the way, I am not sure about any APIs which will directly read a unicode file)
- ns ami -
|
|
|
|