|
|
Hi ,
How Base64 convert "A"(i mean to say single charater) , Or How Base64 convert "image" when send with attachment. I want to know how is it encode the character and decode when receive the character.
plz give me in detail.
Thanks
|
|
|
|
|
|
Check out Bob Withers download section.
http://www.ruffboy.com/download.htm
|
|
|
|
|
I am creating a 'ResDiff' tool to determine if two modules have similar or different resources.
I can already load all resource blocks as binary blocks of data and detect if they are the same or not, but I am having trouble decoding the STRINGABLE block, which can contain up to 16 resource string entries each.
It seems MSDN is all over what the RC file format is, but is very unclear about what the binary format is once it is compiled into an EXE file.
Does anyone have a link they can point me to with an explanation or some sample code?
Thanks.
C++/MFC/InstallShield since 1993
|
|
|
|
|
Check out Matt Pietrek's MSDN article "Peering Inside the PE: A Tour of the Win32 Portable Executable File Format", specifically the "PE File Resources" section.
|
|
|
|
|
Hi everyone,
I am trying to scroll a window by more than one unit at a time. currently I am doing this
[CODE]
for(int i=0; i<100; i++)
pParent->m_SkinList.PostMessage(WM_VSCROLL, MAKELONG(SB_LINEDOWN,0),NULL);
[/CODE]
I have my current code inside a for loop to make it scroll down multiple times and it works, but it freezes up my app until the for loop is done.
How can I scroll by multiple lines using a single PostMessage call? Can I scroll variably in a single call without using a for loop?
Thanks,
Greg
|
|
|
|
|
The HIWORD of the wParam parameter is the position to scroll to
pParent->m_SkinList.PostMessage(WM_VSCROLL, MAKELONG(SB_LINEDOWN,nPos),NULL);
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Do exactly as you`ve been told, and mind that the SB_PAGEDOWN could be used too.
Sincerely yours, Ilya Kalujny.
|
|
|
|
|
Hi all,
I have a question about SetFont.
Now I create a class that is derived from CWnd, and use SetFont to set a
font to it. Then I override the Paint function to display the content I
want. The problem happens there, no matter what font I set, when I draw the
text in Paint, it display with the same font, I think it is the system font.
How can I make the SetFont work?
Thanks in advance
|
|
|
|
|
if you are using DrawText or TextOut, you have to use CreateFont/SelectObject . SetFont doesn't do what you think it does.
something like this:
CFont fnt;
fnt.CreateFont(...);
CFont *pOldFont = dc.SelectObject(&fnt);
dc.TextOut(...);
or
dc.DrawText(...);
dc.SelectObject(pOldFont);
-c
CheeseWeasle
|
|
|
|
|
Thank you for your reply.
After reading your comment, I have another question. I have used SetFont to set a font to it. How can I know which font I have set when I want to use it in Paint function. Because my class is used by other people, I have to use a generic way to know which font they set. Actually I have tried another way, I override the SetFont function in my class, and remember the font they said. It worked. But because the SetFont is not a virtual one, when they use a CWnd pointer to call the SetFont function, my SetFont will not be called.
Thanks again.
|
|
|
|
|
vincentye wrote:
How can I know which font I have set when I want to use it in Paint function
have you tried GetFont() ?
-c
CheeseWeasle
|
|
|
|
|
Sure I did.
Some of my code is below:
void CColItem::OnPaint()
{
CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
CRect rect;
GetClientRect(rect);
CFont *OldFont = NULL;
OldFont = dc.SelectObject(GetFont());
..............
dc.TextOut(xText, yText, strWindowText);
..............
dc.SelectObject(OldFont);
}
Thanks again
|
|
|
|
|
The painting code is right. It sounds more like that the code you're using to test it is somehow not passing the right font. Or perhaps you're creating a font that's local (allocated on the stack) and it's going out of scope. SetFont takes a pointer. If that pointer becomes invalid, I'd suspect that the dc.SelectObject( GetFont() ); would fail.
If you're unsure, post the code that calls SetFont and I'll take a look.
Joel Lucsy
|
|
|
|
|
Thank you for your information. However it is not that case.
Below is the answer from MS newsgroup:
"
There is no default implementation of WM_SETFONT and WM_GETFONT. You
need to implement these message handlers to store and return the current
HFONT (or NULL as the case may be), and Invalidate if LPARAM is TRUE.
IIRC, ClassWizard won't help with these, so you'll need to add them
manually using ON_MESSAGE macros in your message-map, and remember that
the prototype is 'LRESULT memberFxn(WPARAM, LPARAM)'. In your WM_PAINT
handler, you will need to SelectObject the currently stored HFONT (if
there is one) into your CPaintDC, and SelectObject it back out again
when you're done.
--
Jeff Partch [VC++ MVP]
"
I follow his instruction. It works well.
Anyway, thanks again.
|
|
|
|
|
When you call SetFont() , are you doing something like this?
CFont font;
font.CreateFont(...);
SetFont(&font); If you do this, the font will be destroyed as soon as the CFont object goes out of scope, so the default system font will be returned by GetFont(). Make sure you either detach the font (CFont::Detach() ) or use a font object that is a class member.
Hope this helps,
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I am trying to set a bitmap as background for the CRebar control. But it seems it can only display the image as original size. How can I scale the picture according to the size of the rebar. I want the whole bitmap as background.
|
|
|
|
|
hi all
thakns for your help so far
at the moment im using the following to convert a string to long
CString stud_id = "00123"
long l;
l = atol (stud_id);
which works ok, but it removes the leading zeros off
so im left with l = "123"
when i want l to = "00123"
does ne1 have ne ideas how to solve this
thanks
si
|
|
|
|
|
The long data type doesn't work like that - 00123 and 123 are identical, because they are stored internally as a binary number, instead of the characters that make up the digits. If you go the other way, look at this:
<br />
long l=123;<br />
CString str, str2;<br />
str.Format(_T("%.5d"), l);
str2.Format(_T("%d"), l);
Note that if you write:
<br />
long l=0123;
Then a C/C++ compiler will treat the literal value as base-8 (octal) instead of base-10 (denary).
--
Ian Darling
|
|
|
|
|
si_69 wrote:
which works ok, but it removes the leading zeros off
so im left with l = "123"
Leading zeros on a number has no significance to the value itself.
123, represented as a number implies an infinite number of leading zeros!.
123 == 0123 == 00123 == 000000123
If you, however, need to display your number with leading zeros, then you can either stick with your string representation, or use something like:
<br />
CString strValue;<br />
long nValue = 1234;<br />
<br />
strValue.Format(_T("%.6ld"), nValue);<br />
<br />
std::cout<<(LPCTSTR)strValue<<std::endl;<br />
"..Even my comments have bugs!"
Inspired by Toni78
|
|
|
|
|
RChin wrote:
Leading zeros on a number has no significance to the value itself.
Really? Tried e.g. sscanf lately? As any good C or C++ programmer should know, any number (including literals within the program itself) having a leading zero is an octal number.
Now, let's try to rephrase that statement.
|
|
|
|
|
Sorry. Didn't realise I had to take into account all the number bases on the face of the planet as well! I was commenting on the representation of any number by the system.
See Ian Darling's comment above. He probably has made it more clearer.
So let me rephrase that:
With respect to our natural counting system, .....
"..Even my comments have bugs!"
Inspired by Toni78
|
|
|
|
|
I see this is a student id#. Even though this is a number in most cases it is better to leave it as a string. But if you want to save space and you know it is a fixed # length you can add the leading zeros back when you display the number. Try something like printf("%05d",l); will make it back to 5 digits by adding leading zeros.
John
|
|
|
|
|
Anyone know how to force a socket to close in user mode that may be running in another process. Not wanting to to have to write my own firewall here, but from what I can tell so far, its either writing my own Winsock layered service or writing a kernal mode driver to hook into the network stack, which I don't really trust myself to do. I'm not wanting to look at things at the packet level, just stop inbound connections on particular ports from a range a IP addresses that I want my app to decide on the fly.
I'm wanting simply to block connections from IP addresses I choose on ports I choose easily. I know there are things out there, but I'm wanting to have a go myself.
From what I can tell, this seems much easier on Unix that Windows.
"Je pense, donc je mange." - Rene Descartes 1689 - Just before his mother put his tea on the table.
Shameless Plug - Distributed Database Transactions in .NET using COM+
|
|
|
|