|
I still don't quite understand what you need - You want to be able to drag an image around on the
dialog but it should go to the top/left?
Do you have the dialog with an image already? If so, are you drawing the image or using a
control to draw the image? This info will help me hopefully provide some help
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi,
that is what I exactly need
when dialogbox appears .then I want load image from file(.bmp,.jpeg ect)
on the dialog box area . default its left top will be (0,0) at starting.
now I want to drag it by mouse so that its position change and also
I want to appear its changing top left coordinates in Textbox.
I need its code urgent . please help me . i am searching lot but could
not get result. if you forward me mail it will be great helpfull
RajeshGupta
|
|
|
|
|
You can break this down into easier steps...
1) Load the bitmap
2) Sometime in or after the WM_INITDIALOG message is received in the dialog, calculate the rect
the image will be initially drawn at (relative to the client area of the window).
3) If you just want to draw the image on the face of the dialog, add a WM_PAINT handler to the
dialog which draws the image at the image rect position
That'sll get your image drawn in one place on the dialog. Now you want to be able to drag it...
1) Add handlers for the WM_LBUTTONDOWN, WM_MOUSEMOVE, and WM_LBUTTONUP messages.
2) When you receive a WM_LBUTTONDOWN, check if the cursor is within the image rect.
If it is, store the current cursor position and call SetCapture() to capture the mouse to your
window.
3) When you receive WM_MOUSEMOVE, call GetCapture() to see if you are in a drag (if the mouse is
captured to your window). If yes, compare the cursor position with the position saved in step 2.
If it has changed, then the position difference is how far you need to offset the image rect.
Erase the previous image, offset the image rect, and redraw the image at the new rect.
4) When you receive WM_LBUTTONUP, call ReleaseCapture().
Here's sample code: Using Mouse Input[^]
If you have a more specific problem with any of the steps outlined above then just ask
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
|
hi all
i build an application in vc++ MFC
i add a button on dialog box and write upload
now i want that when i click on this button i get
a list of drives in the system to upload a file
can i get help regarding this
thanks alot
hi
|
|
|
|
|
paras_s12 wrote: a list of drives in the system to upload a file
Did you see CFileDialog?
SHBrowseForFolder - Displays a dialog box enabling the user to select a Shell folder.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
paras_s12 wrote: ...get a list of drives in the system...
Use GetLogicalDriveStrings() .
"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
|
|
|
|
|
|
I want only one instance of my application to run at a time.
So i have creted a CSemaphore object with a name "app" in the global area.
And in the Initinstance of the app class i am checking whether it is locked or not. if not locked, locking it and continue otherwise, return false.
Its working fine. What i want to know is how can the CSemaphore object exists between the two different applications even when the application is closed?
Thanks in advance for the reply.
KIRAN PINJARLA
|
|
|
|
|
The Semaphore is actually like a system-wide flag - it's handled by the OS. Once you create (and lock) the named semaphore from one instance of your application, Windows will not let you do that in the second instance ...
|
|
|
|
|
|
for single instance my preference is alwways mutex due to memory overhead and other thing!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
i have to download a file from a url. while sending request system hangs at BOOL bSend = ::HttpSendRequest(m_hHttpFile, NULL, 0, NULL, 0); whats wrong with this.
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
Are you using MFC?
The class CHttpFile provides the functionality to request and read files on an HTTP server.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
yes i am using mfc.
m_hHttpFile = HttpOpenRequest(m_hHttpConnection, NULL, m_sObject, NULL, NULL, ppszAcceptTypes, INTERNET_FLAG_RELOAD |
INTERNET_FLAG_DONT_CACHE | INTERNET_FLAG_KEEP_CONNECTION | INTERNET_FLAG_NO_CACHE_WRITE , NULL);
if (m_hHttpFile == NULL)
{
return DLFAILED;
}
BOOL bSend = ::HttpSendRequest(m_hHttpFile, NULL, 0, NULL, 0);
thi is the code.
Arise Awake Stop Not Till ur Goal is Reached.
|
|
|
|
|
See Here[^].
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
deeps_cute wrote: i have to download a file from a url.
How about URLDownloadToFile() ?
"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
|
|
|
|
|
|
I have a dialog based application in VC 6.0 MFC. I want to port in to VC++ 2005 with few additions.
Additons are:
1- I need to add a window form to this MFC App, which will be the main form from where all other forms will be loaded on button click.
2- Add ADO.Net support to MFC Project.
How can this be done?.
Thanks in Advance.
Z.A
|
|
|
|
|
zubair_ahmed wrote:
1- I need to add a window form to this MFC App, which will be the main form from where all other forms will be loaded on button click.
OK, so you need to change the main form. I'd say it's probably easier to do this in VC6
zubair_ahmed wrote: 2- Add ADO.Net support to MFC Project.
OK, so you need to add C++/CLI support to your app. Then you can use .NET classes where-ever you like.
The other issue is, VC6 is a bad C++ compiler, unless you've written very good code, expect to make changes before it compiles.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
Should this be taken as solution ?
Z.A
|
|
|
|
|
hi everybody,
i need to implement excel and its functionality in C#.NET form and display excel existing data in the C# Form and also use the functionality of excel in Form how to do
Prathap
|
|
|
|
|
This is the C++ forum.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I would like some advice on which STL container is best given the following requirements
* I need to store in memory a collection of unsigned ints
* Only one thread will touch the collection
* Speed is critical for add/find/remove
* I need to add to this collection, usually I will be adding a continuous range (eg 10, 11, 12, 13, 14)
* I need to find out if a specific value is in the collection
* I need to remove specific values
* I would like to minimise memory usage by allocating storage for the most common size of this collection at startup, have the collection expand itself if nessasary (without moving existing items) but never shrink itself
Is there an STL container that can meet all of these or do I need to make my own?
|
|
|
|
|
Will you be adding elements just to the end, at the start and end or at any location?
Will you be removing elements just at the end, at the start and end or at any location?
Do you need to preserve the insertion order?
Do you need to be able to iterate over the collection in numerical order?
Are multiple copies of the same value allowed?
Steve
|
|
|
|