|
is it possible to create a simple application and delete it while it is running?
ie:
run c:\mySimpleApp.exe
(the app. copies itself-mySimpleApp.exe to memory space with CMemFile ???)
delete c:\mySimpleApp.exe but process is still running
obviously the challenge is to overcome "the application is currently in use" dialog.
any ideas?
|
|
|
|
|
You cannot delete a file while it is being executed (access denied).
BTW CMemFile is just like CFile but it writes to and reads from memory instead of hard disk.
If you mean the Task manager by "the Application currently in use" then this is impossible, you cannot hide runnig processes from it.
Bunburry
|
|
|
|
|
Hello,
I am trying to add video capturing to my application using a USB webcam. My application is an MFC application. I am trying to use the 'capCreateCaptureWindow' function as I found stuff about this on the msdn library. However, I am fairly new to Visual C++ and MFC applications so I was wondering if anyone could possibly talk me through the process? There's lots of stuff about this on the msdn library but I'm getting confused.
I know I should somehow create a capture window of the AVICap window class and connect it to a video driver and then the capture window should be ready to capture data. But how do I do this in practice?
If anyone has time, could they please talk me through each step of this process?
Alternatively, if anyone knows any good tutorials on how to capture video, could you please send me a link?
Thank you for your time.
|
|
|
|
|
Make sure that your webcam supports video for windows.
From personal experience VFW can be a pain to develop with and isn't really supported as much anymore (although I'm willing to stand corrected on that point). Although it takes a while to learn, DirectShow is certainly worth the effort. If you go to DirectShow you have the benefit of the sample applications distributed with the DXSDK to help you get started. Some of which may require minimal effort of modify to suit your purpose.
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
Andrew,
do u still remember which sample in DXSDK is about capture screen or capture window? i can't find it.
thx.
includeh10
|
|
|
|
|
Look at the AMCap (?I think) sample to see how to render to a user specified location. Alternatively you could write your own renderer filter.
If all you want to do is capture a frame Microsoft provide a grabber sample to grab a sample from a running filtergraph.
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
I am doing a project where I use functions in C to create letters on the output screen. I need a function which outputs a slope of letters down the screen(examples are below):
1)AAAA 3) XXX XXX
AAAA XXX XXX
AAAA XXX XXX
AAAA XXX
2) AAAA 4) XXX
AAAA XXX XXX
AAAA XXX XXX
AAAA XXX XXX
If anyone could help with a c function which would print any of these outputs, it would be appreciated. Thanks.
|
|
|
|
|
I need help about how to use OpenSSL library.
Is there any sample on the Web I can use ?
|
|
|
|
|
What is it you are trying to do?
|
|
|
|
|
I want to write simple https client..
Is there any good tutorial you can point me to?
|
|
|
|
|
I was astounded when I saw how you program with longhorn, it was easy fast, flexible, AND VERY POWERFUL The user interface was really good looking and VERY EASY TO MANIPULATE. WinFx is very good since .net developers wont have to learn alot of additional stuff. Everything in winfx is CUSTOMIZABLE. As being a c++ programmer, I have seen the future , I will program in visual c++ 6 until probably after the year 2003 (next year) on the .net framework to get a little started. If anyone wants to see the light, go see 2 below movies,
http://msdn.microsoft.com/msdntv/episode.aspx?xml=episodes/en/20031028LHORNDB/manifest.xml[^]http://msdn.microsoft.com/msdntv/episode.aspx?xml=episodes/en/20031107WINFXBA/manifest.xml[^]
The first one is about an hour long, though worth it, and the second one talks Very breifly about WinFX, about 10 minutes.
<marquee>Universal Project... Soon to be a .net
|
|
|
|
|
Hello!
I'm making some kind of file viewer.
but I can't open "next file" in program....
I want to open files with NEXT or PREV button : like 'ACDsee'.
How can I do this?
I use OnOpenDocument for file open and use CDvApp::OnFileOpen().
first, I try CFileFind class to find files. but can not find current Dir and
that have only FindNextfile func.
following: using CFileDialog.
CFileDialog fileDlg(TRUE, NULL, NULL, OFN_HIDEREADONLY, szFilter);
if(IDOK == fileDlg.DoModal())
{
OpenDocumentFile(fileDlg.GetPathName());
POSITION pos = fileDlg.GetStartPosition();
((CDvMenu*)pMenu)->NextPath = fileDlg.GetNextPathName(pos);
}
in this, NextPath have not 'next'. It is same as current-opened file's.
Why this?
|
|
|
|
|
Analysis of the posted code:
The 'GetStartPosition' and 'GetNextPathName' methods are used to run through a list of selected file names. To enable this kind of behaviour, your FileDialog must sport the 'OFN_ALLOWMULTISELECT' style. Now, when the dialog is shown, you must select multiple files by holding CTRL or SHIFT down when clicking names.
After the call to DoModal returns (you click Ok), the file list is ready, and can be browsed through by using the above mentioned methods. Remember to check the return values of GetStartPosition and GetNextPathName. First one returns NULL if there is no file list, and the latter returns NULL if the list has ended.
From your description, however, I understood that you wanted to create a quick file preview/browser application. For this purpose, you should approach the problem from a bit different perspective: create a list of existing files in a directory, and move through this list when the user is clicking the buttons.
The MFC class CFileFind is perfect for this purpose: first use it to enumerate the file names in the current directory, and save these to e.g. a list of CString objects (CString strList[MAX_NUMBER]). Now, at the start of the browsing, initialize the position integer (iPos) to zero, and open the file pointed to by strList[0]. When user clicks 'prev' or 'next', increase or decrease the iPos value and re-open the file. Remember to close the currently open file first, though, or you might end up with a HUGE memory leak of open file handles.
Here is a code fragment to get you started. It will enumerate through the current directory, accepting all files. These file names are written to a static CString list. This list must be a member of your application class, so it doesn't go out of scope after the enumeration returns.
void EnumerateFiles(void)
{
int iPos = 0;
CFileFind cfFinder;
BOOL bContinue = cfFinder.FindFile("*.*");
while (bContinue)
{
bContinue = cfFinder.FindNextFile();
strList[iPos] = cfFinder.GetFileName();
iPos++;
}
cfFinder.CloseSearch();
return;
}
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
I'm using the class wizard in Visual Studio 6 to create OnLButtonDown() and OnLButtonDBClick() handlers, searching for hits in the same region. How do I avoid executing my OnLButtonDown() handler for double clicks?
Jason
|
|
|
|
|
If you used the App Wizard to create the project for you, then go to your main window's (Frame window or dialog) PreCreateWindow override. If you don't have this override yet, create it by using Class Wizard.
In this override, you must register a new window class (AfxRegisterWndClass) with 'CS_DBLCLKS' class style, and place the return value of the registration call to the class name member of the CREATESTRUCT structure. Now, whenever user double-clicks the mouse over your window, a WM_LBUTTONDBLCLK / WM_RBUTTONDBLCLK message is generated for the window.
Here's a code fragment to help you out:
BOOL CMyDerivedCWnd::PreCreateWindow(CREATESTRUCT& cs)<br />
{<br />
cs.lpszClass = AfxRegisterWndClass(CS_DBLCLKS, NULL, NULL, NULL);<br />
<br />
return CWnd::PreCreateWindow(cs);<br />
}
The single-click and the double-click are seperate events. You create the first by clicking once, and you generate the second by clicking twice quickly. So, when you do a quick double-click, only the double-click event is sent, providing that your window class style supports double-click messages, as specified above.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Hmm, I must be using the wrong messages. I tried adding the code frament suggested, however, I'm getting the same results. When I double click the region, the single click (WM_LBUTTONDOWN) event is handled first, followed by the double click (WM_LBUTTONDBCLK) event. In other words, both event handlers are being called. Are these the correct messages to use for this?
Jason
|
|
|
|
|
If you need to have specific, unconditionally seperate handlers for the single-click and the double-click, then I think you should consider a completely different approach: capture the mouse and monitor it's clicks. If a click is made, and another click is not made in the next 20-50 ms, then a custom WM_LBUTTONDOWN message is generated, otherwise, a custom WM_LBUTTONDBLCLK message is made.
Doing this MFC-way would mean resorting to a little more than an outright hack..
This means that in addition the standard WM_ handlers, you must create more UINTs for custom WM_ messages, such as WM_CUSTOM_L/RBUTTONDOWN and WM_CUSTOM_L/RBUTTONDBLCLK (this would mean four new UINTs), which your application then handles. In the standard handlers, you calculate the time span between clicks, and determine the custom message based on these calculations.
A bit more work, but doable, I think. For example, add two timers, both with a custom WM_CUSTOM_TIMER1/2 message applied, to your application, which you start and stop with the clicks. When a WM_L/RBUTTONDOWN message is received, the timer is started. If a new message of same type is received and the timer is still running, then the timer is stopped and a WM_CUSTOM_L/RBUTTONDBLCLK message is generated. If the timer is allowed to run to it's first 'WM_CUSTOM_TIMER1/2' handler, it generates the WM_CUSTOM_L/RBUTTONDOWN and stops itself.
In addition to this, you should override the WindowProc member function to get a direct access to the window procedure and message handling of your application. Alternatively, you can also write the required message map entries manually. Use ON_MESSAGE ( <Message ID>, <function name> ) entries in the map.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
When you double-click, three messages are generated
WM_LBUTTONDOWN<br />
WM_LBUTTONUP<br />
WM_LBUTTONDBLCLK
You can set a timer in the LBUTTONDOWN handler, then if the LBUTTONDBLCLK message arrives, kill the timer. Otherwise, when the timer fires, run your single-click code (and also kill the timer, so it only fires once).
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | RightClick-Encrypt | 1ClickPicGrabber
"Linux is good. It can do no wrong. It is open source so must be right. It has penguins. I want to eat your brain."
-- Paul Watson, Linux Zombie
|
|
|
|
|
Has any one ever worked with the BITMAPV4HEADER & BITMAPV5HEADER bitmaps? I know what versions of Windows these are supported on but have been unable to find any bitmaps using these headers. I am interested in adding support for these bitmap types to a class I have developed for using DIBs. I beleive my class will have no problem reading these files but the new data fields ,in these headers, will be ignored.
When should I use one of these newer headers?
Is there any examples of how and when to take advantage of these newer types?
I have searched the www and only found descriptions of the headers, plus one file that recongises BITMAPV4HEADER.
INTP
|
|
|
|
|
The BITMAPV5HEADER has enhanced support for JPEG compression, including the ability to pass a JPEG DIB to StretchDIBits(). I have the old MSDN98 docs - email me (thru CP) if you want me to send the BITMAPV5HEADER page to you.
|
|
|
|
|
Does anybody know of an easy to use class that I can use to popup the windows address book app (wab.exe) and get back the users selection, both the email address and the friendly name?
Or maybe an implementation of the "Select Recipients" dialog and the "To" address bar used in outlook express?
Basicly, I want to be able to let my users select recipients from their address book.
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!
|
|
|
|
|
Frankly i'm a little shocked that you didn't look here first :
http://www.codeproject.com/cpp/wabapi.asp[^]
Granted, it doesn't popup the app, but you can throw the names in a listbox and let the users choose.
...cmk
Save the whales - collect the whole set
|
|
|
|
|
cmk wrote:
i'm a little shocked that you didn't look here first
hmmmm, I am a little shocked too. I totally missed that article, thanks for the link
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!
|
|
|
|
|
The path to wab.exe on any machine you can find by searching in the registry.
The default value of HKCR\.wab gives you the key where you will find the full path to wab.exe. On my XP this is HKCR\wab_auto_file, where you have to look at shell\open\command the default value of which contains the full path.
However the wab.exe (as far as I am concerned) cannot return the email address to an external app because, there is no button for this either. You just can open the default mail writer from it which is actually a ShellExecute with the selected email address from wab.exe.
The only way for you is to extract all emails and friendly names from wab.exe without showing it to the user and construct your own dialog with this data, which you can fully control.
The extraction of email addresses from wab is desribed here:
http://www.codeproject.com/file/findidaddressbook.asp[^]
Bunburry
|
|
|
|
|
Thanks for the link
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!
|
|
|
|
|