|
1, one window, can change the size, where use the SetWindowRgn()?
2, i want paint it gradient background, because the window can change the size, when the size is changed, i need redraw the background, how to do?
sorry, my english not good, can see and not can say.
|
|
|
|
|
HOW WHAT wrote: one window, can change the size, where use the SetWindowRgn()?
Hmm didn't get you.
HOW WHAT wrote: 2, i want paint it gradient background
You can use GradientFill function for this purpose.
HOW WHAT wrote: because the window can change the size, when the size is changed, i need redraw the background, how to do?
To redraw background on size change just handle WM_ERASEBKGND and return TRUE to indicate to the application that you have done the background drawing.
Love Forgives--Love Gives--Jesus is Love <marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" style="background-color:'#44ccff'">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
thanks for your Reply.
1.i try in OnSize() used SetWindowRgn(),right? have other idea? my mean is the windows is small and SetWindowRgn it is small round, and the window is big SetWindowRgn it is big round.
2.Some time ago, i tried your method but when the window size change big, the background is confusion, the old background(1) still exist, other area redraw ok.
old size
|--------|-------|
| 1 | |
|--------| |
| |
| background |
|---------------| now size
BTW:i say the window can change the size , mean is the window flags had WS_MAXIMIZEBOX and WS_THICKFRAME
My english so bad, shame.
-- modified at 0:52 Thursday 5th January, 2006
|
|
|
|
|
Yeah it happens because the visible portion need not be painted again.
Try using CClientDC. This way you can paint the entire region.
Love Forgives--Love Gives--Jesus is Love <marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" style="background-color:'#44ccff'">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
Use METAFILE property.
rohini sharma
|
|
|
|
|
I would like to write a program which can browse the bitmap files in a predefined folder. I think I shall use a listbox. But how to display all the bitmap files image in the listbox instead of display the name of the files.
Please give me some suggestion!
|
|
|
|
|
An OwnerDrawn(not me;P) List Box.
Love Forgives--Love Gives--Jesus is Love <marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" style="background-color:'#44ccff'">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
Can you give me more hints about OwnerDrawn(not you) List Box.
Please help!
|
|
|
|
|
Articles galore in CP. Try one of them.
Love Forgives--Love Gives--Jesus is Love <marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" style="background-color:'#44ccff'">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
Use CImageList with ListBox?
Could you please give me more hints?
|
|
|
|
|
Why do humanbeings have confusing identity
OwnerDrawn(not you)
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
Hi,
Use GDI+ to draw the bitmaps.
Make the list box owner drawn.
Create a Graphics object and initialise with the listbox DC.
Create an Image object and using Graphics::DrawImage draw the image in the required cell.
Image and Graphics are GDI+ classes.
Thanks and Regards,
Cool Ju
Dream Ur Destiny
|
|
|
|
|
Thank you for your answer!
I need to read the bitmap files from a predefined folder.
I would like to know that I do need to use CImageList or not?
Please help!
|
|
|
|
|
Hi,
Check this[^]
Thanks and Regards,
Cool Ju
Dream Ur Destiny
|
|
|
|
|
I had checked it.
I found that he use CImageList.
I would like to know how to use CImageList with ListBox?
What is the concept of it?
Please help!
|
|
|
|
|
Hi there, Iv wrote a program to transfer files between a cleint and a server,the code works fine for small files but not for large files,im going to post the code wich i hope will help other people trying to do something similar and in hope that i can get some suggestions on how to improve the code iv wrote.
<server>
{
char *buffer;
char sizebuf[20] = "";
long SizeOfFile = 1;
long BytesSent = 0;
std::ifstream file ("C:\\Windows\\Example.exe" std::ios::in | std::ios::binary | std::ios::ate);
if (!file)
{
MessageBox(NULL,"Error Opening File",NULL,MB_OK);
}
SizeOfFile = file.tellg(); //get size of file
file.seekg (0, std::ios::beg);
ltoa(SizeOfFile,sizebuf,10); //put sizeoffile in char buf
send(newsock,sizebuf,strlen(sizebuf),0);//send the size to client
buffer = new char[SizeOfFile];
file.read (buffer,SizeOfFile).eof();
do{
BytesSent = send(newsock,buffer,SizeOfFile,0);
}while(BytesSent < SizeOfFile);
Here i dont know if i should be reading blocks of the file into the buffer in the do while loop or out side of the loop and i dont know how to equally divide the file into "Chunks" to be sent separatly and rebuilt the other side help would be appriciated
<client><mfc>
{
char buffer[20];
long SizeOfFile = 0;
char* recvfilebuf;
recv(Socket,buffer,sizeof(buffer),0); //recv size of file to be d/l
SizeOfFile = atol(buffer);
ZeroMemory(buffer,20);
recvfileBuf = new char[SizeOfFile];
std::fstream file (C:\\Example.exe, std::ios::out | std::ios::binary | std::ios::ate); //Dir of our new .exe
if (!file)
{
MessageBox(NULL,"Error Opening File",MB_OK);
}
do
{
recieved = recv(Socket,recvfileBuf,SizeOfFile,0); //recv actuall file
file.write(recvfileBuf,recieved).eof(); //write new file
}while(recieved < SizeOfFile);
ZeroMemory(buffer,20);
}
I know there is a better way of doing what im trying to do but its hard without extensive know how on the subject..Any comments would be greatly apriciated
Thankyou
|
|
|
|
|
use CFtpConnection
never say die
|
|
|
|
|
Question : In MDI application, when I open a new document, I want the frame size set by myself rather than the fixed size set by MFC. I wonder where should I implement this, and how?
Thanks
|
|
|
|
|
In the view, I would have thought. That's the class responsible for the way the document is represented, so when one is constructed and shown, you'd need to size it.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Did u try to use this functin for frame ?
SetWindowPos()
find it out in the MSDN for more details
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
Hi,
I have created threads using CreateThread (6 parameters) format in vc++ as following
DWORD ThreadId_1,ThreadId_2;
CreateThread(NULL,0,StartThread1,CREATE_SUSPENDED,0,&ThreadId_1);
CreateThread(NULL,0,StartThread2,CREATE_SUSPENDED,0,&ThreadId_2);
where StartThread1 and StartThread2 are the thread functions correspondingly. 'this' refers to my present main application.
I would like to suspend and resume the threads at any point of time, but I didn't understand how to use SuspendThread and ResumeThread functions. I would really appreciate if someone can help me on this (how to suspend, resume and close threads whereever I need) using the above example.
thanks,
-Pav
-- modified at 17:09 Wednesday 4th January, 2006
|
|
|
|
|
If you call C-run time functions in any of your thread functions, you should be using beginthreadex instead of CreateThread.
If you are using MFC, you should use AfxBeginThread instead of beginthreadex.
Having said that, use the thread handle to ResumeThread to get it started again. You can check return value to decide if it was supposed to actually resume or not. If the return value is zero, the specified thread was not suspended. If the return value is 1, the specified thread was suspended but was restarted. If the return value is greater than 1, the specified thread is still suspended.
Use the handle to the thread to SuspendThread. Be mindful of this warning:
Calling SuspendThread on a thread that owns a synchronization object, such as a mutex or critical section, can lead to a deadlock if the calling thread tries to obtain a synchronization object owned by a suspended thread. To avoid this situation, a thread within an application that is not a debugger should signal the other thread to suspend itself. The target thread must be designed to watch for this signal and respond appropriately.
Marriage slows down your coding, a baby slows it down even more!
|
|
|
|
|
Hi Blake,
thanks for ur reply. I am not able to figure out which one is the thread handle, while I am using my thread name ThreadId_1 (assuming its the handle), it is giving syntax error.
Actually in my program I need to make anyone of the threads to be active at any time depending on the user input. So i need to suspend and resume them accordingly. I am not getting the correct syntax on using those functions. Can you gimme some sample syntax code for my example. I am using these threads in my MFC application, but these threads wont handle any windows, but only to do the processing.
I did have another version of my program with AfxBeginThread, but there too I need to know the syntax.
thanks,
-Pav
|
|
|
|
|
HANDLE CreateThread(
LPSECURITY_ATTRIBUTES lpThreadAttributes,
SIZE_T dwStackSize,
LPTHREAD_START_ROUTINE lpStartAddress,
LPVOID lpParameter,
DWORD dwCreationFlags,
LPDWORD lpThreadId
);
In other words, the value RETURNED from CreateThread is what is used in the calls to Resume and Suspend.
Or, you can get the thread handle using OpenThread, if you know the thread identifier.
HANDLE OpenThread(
DWORD dwDesiredAccess,
BOOL bInheritHandle,
DWORD dwThreadId
);
Be sure to close the handle you opened if oyu use this second approach.
I usually retain the thread handle returnd from CreateThread instead of constantly opening and closing the thread handle.
Marriage slows down your coding, a baby slows it down even more!
|
|
|
|
|
Marriage slows down your coding, a baby slows it down even more!
thats something really true ,
actually marriage changes lots of things??
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|