This is the code i use. I call StartEXE with a String like C:\\test.txt , the programmpath is fix in the code.
The Programm i want to open opens but it don´t open the path.
This happens only by one Programm, if i want to open another programm this code works.
Without seeing the actual parameters and the code of the executing program it's impossible to guess what may be happening. It would probably be a good idea to add some debug code to the called program so you can see exactly what parameters it is trying to deal with. What is the "runas" parameter supposed to do?
Thats what i wanted to hear
The "runas" is to start a exe with admin rights.
Is it right that open a Programm with ShellExecute is different to Drag&Drop way ? Because if i drag and drop a textfile on the Program i want to open it works. btw the program is a finished one done not by myself.
Is there a way to drag&drop the textfile to the program via code?
Starting a program by command line and drag&drop are different things. An application can implement any (or neither). You cannot simulate drag&drop from code if that application is not handling the drop.
I have started programming with Visual C++ recently. I have created a dialog based application which has some buttons. When I click one of the buttons I want a window to pop up(which will eventually display an image). Can you please tell me how to do it? Thanks in advance,
Thanks Richard for your reply. FYI I am doing the development using Visual C++. From the image window which pops up I would like to process mouse messages etc . Would that be possible if the image window is created with CreateWindowEx? I was thinking that the pop up image window should be created with a combination of CFrameWnd and CView. Is that the way to go? But I don't know how to do that. Thanks very much,
It's not easy to give a definitive answer to your question because I am not sure exactly what you are trying to do. But it sounds like you are starting from the wrong position. Why are you creating a popup window from within a dialog? Why not go for a standard CFrameWnd with whatever View type inside that will display the information that you want to show?
Ok I am trying what you have suggested. In that case also when the user clicks on the image(which is displayed on the CFrameWnd with view window) I want another image window to pop up which will display information corresponding to the clicked point. Please help. Thanks very much,
You previously said the you wanted the popup to display information about the image. In either case you just need to add the information to your dialog, either by adding static information in your dialog resource, or by adding it at run time. Adding information to a dialog at run time can be done in response to the WM_INITDIALOG message[^] or in response to some user action on one of the dialog controls.
Thanks for the reply. You are not understanding my requirement. When I click somewhere on the client area of the application I want to display a image(2-D)(thru a Cview object possibly). Something like what you would get on displaying a image with Microsoft Paint. Instead I am reading the image and displaying it. I don't think a dialog can do that display. I know how to read the image but I don't know how to display it in a pop-up window(a window other than the main application window). I hope I am clear. Regards,
You can display an image in any sort of window, it is just a matter of writing the code to do the work. Whether that window is a CView, a dialog, or any other type is not important. What I am confused about is the fact that you seem to be talking about more than one image and more than one window; but which one comes first and what does it contain?
Thanks for your reply. In very simple terms I have a SDI application which displays an image. Now when the user clicks on a point on this image I want to display a pop up window with another image(This image is the grating[2-d array] corresponding to the color of the point clicked). I have made the SDI application which displays the 1st image.But I don't know how to make a popup window with the grating image. I have searched a lot on the web with no luck. It's frustrating. Please comment asap. Regards,
I'm not sure what a grating image is, but assuming you can create it using Windows GDI or GDI+, then any Window type should be OK to display it. The simplest option would obviously be a Dialog with a Static Control[^] on which you would display this image.
I am attempting what you have suggested. But I am curious how to open a pop-up window from the SDI application(CWinapp1+CDocument1+CFrameWnd1+CScrollView1) which shows the first image. The pop-up window (CWinapp2+CDocument2+CFrameWnd2+CScrollView2) which corresponds to grating/second image has to be displayed from CSrollview1::OnLButtonDown. If I can do that, it would save me a lot of effort. But I don't know how to do it. In CSrollview1 I tried
AddDocTemplate(pDocTemplate2);//corresponding to 2nd document
but it didn't work that way. Please guide me. Thanks very much,
Adding another document template is not what is needed in your case. As I have suggested a number of times, using a simple modal dialog would be the simplest way to create what you need. Alternatively, you can create a stand-alone window with the appropriate styles[^] and display it until the user requests it to be discarded.
What you have suggested(dialog with bitmap static control) has mostly worked. I agree it would be the shortest route. I have a small issue. When I click on the 1st image I get the pixel/color value of that point. Now I have to pass that to the dialog box which is popped up. Any clue how I would do that.
void CCreateGratingsView::OnLButtonDown(UINT nFlags, CPoint point)
// TODO: Add your message handler code here and/or call default
CClientDC dc (this);
//dlg should receive Red Green Blue
To add to what I have stated previously, From the Cview object(OnLButtonDown f.n) of the SDI application I want to create a pop-up window ,read the second or grating image and display it in the pop-up window. Thanks,
I have a dialog box and a picture control (canvas) on that dialog box. I have a list of Images in my dialog box in a list box. I want to implement Drag & Drop feature in my application. I want the user be able to click on the Image with a mouse and then drag the Image to the canvas.
Handle the drag event in your dialog or the list. If your list is CListCtrl based use a LVN_BEGINDRAG handler. Otherwise use a WM_LBUTTONDOWN handler. From within that handler create a copy of the bitmap, cache it using the COleDataSource class and start the drag and drop operation:
// Get selected image into Bitmap here
stgm.tymed = TYMED_GDI;
stgm.hBitmap = static_cast<HBITMAP>(Bitmap.Detach());
stgm.pUnkForRelease = NULL;
// When moving is allowed pass DROPEFFECT_COPY | DROPEFFECT_MOVE
// here and delete the image when DoDragDrop returns DROPEFFECT_MOVE.
// Don't call default handler here when DoDragDrop has been called.
// Because OLE has handled all further mouse actions.
On the target side, use the COleDropTarget class. If the target is a CView derived class, it is simple to implement by adding a COleDropTarget member to the view, adding the virtual OnDrop... handlers and registering the view as drop target from OnInitialUpdate(). With other window types than CView based ones, you must derive your own window specific COleDropTarget class that knows your window class so that it can access the required functions and members.
From within the COleDropTarget::OnDrop[Ex] function, use the provided COleDataObject to get the data by calling GetData(CF_BITMAP, &stgm).
When using the MFC COle... classes, you must include afxole.h (e.g. in stdafx.h) and call AfxOleInit() from within InitInstance() of your Windows app class.
Hello guys. I am trying to write a small recording program but am stuck in basics. I can not pass the pointer of the WaveInProc function properly. I am trying it in two ways, both of them widely used on online examples.
1 - rResult = ::waveInOpen(&phWaveIn, WAVE_MAPPER, &pcmWaveFormat, (DWORD)WaveInProc, 0, CALLBACK_FUNCTION);
2 - rResult = ::waveInOpen(&phWaveIn, WAVE_MAPPER, &pcmWaveFormat, (DWORD)&WaveInProc, 0, CALLBACK_FUNCTION);
// then tried this one as well, generating error c2440
3 - rResult = ::waveInOpen(&phWaveIn, WAVE_MAPPER, &pcmWaveFormat, (DWORD)(VOID*)WaveInProc, 0, CALLBACK_FUNCTION);
Their corresponding error messages are shown as under
1 - error C2440: 'type cast' : cannot convert from'void (__stdcall CWaveApiDlg::* )(HWAVEIN,UINT,DWORD,DWORD,DWORD)' to 'DWORD'2 - error C2276: '&' : illegal operation on bound member function expression
This is what WaveInProc looks like in my .cpp file
Well, you are passing a pointer to a (non static) method of class CWaveApiDlg where a function pointer is requested. You cannot do that. Either pass a (pointer to a) global function or to a static method of the class.
Read what buffer? Where is the actual bitmap data that you are reading? Assuming the client is sending this as a binary stream from the original bitmap buffer there should be no work to do at the server end other than ensuring you capture the entire buffer.
ifstream is basically for a file and not for a binary data.
What does this have to do with your problem?
As I understand it you are trying to transfer a bitmap from one computer to another via a network socket. So it is just a matter of transferring the binary data without any changes to its structure, and displaying the bitmap on the target system.
either you need to have a protocol implementation in your Clien-Server communication or you have to make sure that you send all the buffer at one time. If you are choosing a protocol means you first send a message to the server that am going to send a image buffer with size/length X and at the server store this and use this value for the next receive command.
If you are going to use whole buffer at one time, just use that buffer as such to create re-create your image. having a protocol is the best choice. if you google you can find many protocols choose the simplest one that suits your requirement.
Hello everybody i have a small question , not big enough for the quick answers . I am working on a MFC project a little bit old. And i had to add a header to the print result. My problem was with the font Size. After some tries i found the really useful Article about Printing trics. The problem was when i used
Printing was ok but the PrintPreview wasnt. The font size was still small and i know why the GetDeviceCaps was returning the dpi of the monitor. This was understandable . After some digging in the code i found that for the rest printed text the font size was calculated a little bit different. For the font Height was taken the absolute value of the height multiplied by the zoom and all divided by some constant. My question is is there some practice about that kind of calculation . To be honest i don't think its a good idea to use it. I don't believe that all printers will print the same thing. But the PrintPreview and the Print result are pretty much the same.
What do you think ?
I created a MFC Smart Device App with Visual C++ in Visual Std 2008. I have dialog forms, I created SQLite database in VS2008. And I imported sqlite.dll sqlite.def etc. files. Now, I want to select data from my database, show in my textlist for example. But I don't know How can I do this.
What is my sqlconnection sentence? How can I create test.db? Which class will I write my sqlconnection sentence, or my select, insert, delete, update sql code? Can anybody explain this step by step?
It is my Job. I research this topic since a week, but still I can not solve this problem. Please help me!
Last Visit: 31-Dec-99 18:00 Last Update: 31-May-16 8:37