|
From where is this control coming from ?? And what is the error ? Is it a compile error (if yes, give the complete error message) or a runtime error (if yes, give as much information as possible).
You don't give us enough information to help you.
BTW, use the tags under the emoticons to format your code, it will be much more readable.
|
|
|
|
|
Dear Cedric,
First, I'm sorry I'm not so clear to you, but I will try to understand you what my situation is.
I want to make a simple dialogbox application just simply to show the video-image of the webcam, using CAvicap class wich encapsulates the win32API fucntions of VFW.dll or .cpp (you can see an article of that class, I'm sorry for the missing link)
So I included the CAvicap class in my DialogBox project.
To use the webcam, I have to do the following steps:
1) Call the Creat method of CAvicap
2) Callthe Connect method of CAvicap
3) Set preview rate (also a function of CAvicap)
4) Start preview (also a function of CAvicap)
And when to close it, I need to call the Disconnect method.
The part of showing the life video on my DialogBox is as follow:
<br />
void CCamSampDlg::OnStart()
{
CRect rect;
GetClientRect(&rect);
<br />
<br />
WebCam.Create(WS_CHILD|WS_VISIBLE,rect,&m_Disp,TRUE);
WebCam.ConnectWithDriver(-1);
WebCam.SetPreviewRate(100);
WebCam.StartPreview(TRUE);<br />
<br />
}<br />
<br />
void CCamSampDlg::OnCancel() <br />
{<br />
WebCam.Disconnect();<br />
OnOK();<br />
<br />
CDialog::OnCancel();<br />
}<br />
Here is the Create method declaration:
<br />
BOOL CAviCap::Create(DWORD dwStyle, const RECT& rect, CWnd* pParentWnd, BOOL fAutoSize)<br />
{<br />
ASSERT(!GetSafeHwnd());<br />
<br />
if(GetSafeHwnd()) {<br />
iLastError=CAP_CREATE_DUP;<br />
return FALSE;
}<br />
<br />
_autosize = fAutoSize;<br />
<br />
HWND hWnd=capCreateCaptureWindow("AviCap_Basic", <br />
dwStyle, rect.left, rect.top, rect.right-rect.left, rect.bottom-rect.top, <br />
pParentWnd->GetSafeHwnd(), AVICAP_WINDOW_ID);<br />
<br />
if(!hWnd)<br />
{<br />
TRACE("CAviCap Window creation failed\n");<br />
iLastError=CAP_WINCREATION_FAILED;<br />
return FALSE;<br />
}<br />
<br />
SubclassWindow(hWnd);<br />
::SetClassLong(hWnd, GCL_STYLE, ::GetClassLong(hWnd,GCL_STYLE)|CS_DBLCLKS);<br />
<br />
<br />
#ifdef ON_CONNECT_CHECK_DRIVERLIST<br />
_getDrvList();<br />
#endif<br />
<br />
return TRUE;<br />
} <br />
By the way the link where you can find the CAvicap class is here:
http://www.codeproject.com/audio/avicapwrp.asp
Well I hope I informed you well, if you want my project to look at it, I can send it to you. And thank you :->
If my application works, I forget all my problems.
|
|
|
|
|
Hi,
With yahoo messenger installed, if you would like to send
an instant message, you can goto Run and type like this
ymsgr:sendIM?somebody
The instant message window will popup. If the yahoo messenger is not running in tray, it will popup after it gets signed.
The same can be done with a hyperlink in a html page.
Yahoo Id: somebody
Now the point how is yahoo messenger achieving this. I would like to do the same for a simple dialog based application. I would like add my application name in the html page and the application should run when the hyperlink is clicked.
Please refer this.
http://www.codeproject.com/html/Yahoo.asp
Thank You
|
|
|
|
|
Normally, if you clik a text anchorded like that:
<A href="YourApp.exe">text</A>
the browser will ask you if the the app is to be saved or to be opened (i.e. run)
SkyWalker
|
|
|
|
|
I think it's not just running that application. It's probably a service that yahoo installs. But that's just a thought.
Also keep in mind that a good browser might block your attempt ( see Firefox), and dependeing on the user's security settings it might not even show a visible trace that the web page was trying to launch an application. It's quite a security flaw to allow web pages to run local applications on the client's machine. Instead, if your application is previously installed on that computer you should probably set-up some kind of communication, maybe on a set port and have your app listen for requests on that port from the web server your page is hosted on.
|
|
|
|
|
Hi mikanu,
This is not about security. Leave alone running an application from web page, if I would like to send an instance message from run, I would use like this
ymsgr:sendIM?mikanu
You can give it a try.
I would like to know about the logic behind the whole thing. Is there any API function so that my application can be registered with the registry or so.
It is similar to "callto:" , "mailto:". Even AOL messenger can also be called the similar way. I would like to run my application like "sampleapplication:". I dont think there can be a service running for each and every application.
Thank You
|
|
|
|
|
Hi vyjesh,
I think I understand now. What you need to do actually is to register your won URL protocol. Basically, when you type something like mailto: or file: windows looks up the URL protocol scheme and transfers the handle to the application registered for that protocol.
In windows XP it's pretty easy to create and register your own protocol. You would have to add a key in the registry under HKEY_CLASSES_ROOT\ and give it the name of the URL protocol you'd like registered. Let's say myproto. So you'd vahe something like HKEY_CLASSES_ROOT\myproto. Then on the default value for that key type: "URL: My_Name Protocol". Also, add a new value to this key and call it URL Protocol. Then add a new key to the myproto and call it shell. You don't need to make any cahnges to this key. Then under it, add a new key and call it open. Also, no changes here. Finally, under open add a new key and call it command. Now, change the default value for this key to: "C:\Windows\notepad.exe" %1. This will make your protocol launch notepad! Pretty cool huh?!
So your registry should be modified as foolows:
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\myproto]
@="URL: Mikanu Protocol"
"URL Protocol"=""
[HKEY_CLASSES_ROOT\myproto\shell]
[HKEY_CLASSES_ROOT\myproto\shell\open]
[HKEY_CLASSES_ROOT\myproto\shell\open\command]
@="\"C:\\Windows\\notepad.exe\" %1"
Then you can try this link: myproto:test.txt and it should lauch notepad and attempt to open a text file, called test.txt...
For further reading on URL schemes check this out, RFC 1738.
|
|
|
|
|
How can I determine that the clipboard content was dropped to the target window?
I implemented a code which moves data between two application using the COleDropSource stuff. Since the data are moved (NOT copied) between the applications I need to know when can I remove the moved data from the source application. So the question is how to determine that the target application pasted/accepted the data from the clipboard (or the drag&drop finished) and it is safe to remove the source data.
Can anybody help me with this?
Thanks,
Abyss
|
|
|
|
|
Abyss wrote:
How can I determine that the clipboard content was dropped to the target window?
I implemented a code which moves data between two application using the COleDropSource stuff. Since the data are moved (NOT copied) between the applications I need to know when can I remove the moved data from the source application. So the question is how to determine that the target application pasted/accepted the data from the clipboard (or the drag&drop finished) and it is safe to remove the source data.
That’s not a very good design idea. What if I the end user of your app have important information on the clipboard? Here comes your app and whips it out.
Your better off posting a user defined message from one app to the other to pass the data. Alternatively you can us IPC “Inter-Process Communication”.
A Simple Wrapper for Sharing Data Structures Between Processes[^]
Inter-Process Communication[^]
-------------------------------
DEBUGGING : Removing the needles from the haystack.
|
|
|
|
|
want to use a CDialogBox in MFC
I want to creat a look similar
to the Print Preview for my
MFC application report view (CScrollView)
any idea
please
send me
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
HEY !!
what do you expect by reposting the same question 1/2h after the previous one ???
if you're not satisfied, consider revising you question first ! and explain why the answers are not satisfying you !
this worthes a '1' !
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Hey cool up buddy
there was a problem at my
server so i didnot find my
questin on the forum , after
1/2 hour also , so i just
refreshed the page and the
msg was posted again.
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
vikas amin wrote:
I want to creat a look similar
to the Print Preview for my
MFC application report view (CScrollView)
Whats wrong with using the standard CPrintDialog? See KB
CPrintDialog[^]
-------------------------------
DEBUGGING : Removing the needles from the haystack.
|
|
|
|
|
Hi All
Could someone kindly let me know how to identify the currently highlighted (tabbed) button on a modeless dialog before it is pressed? I've looked at GetFocus but that seems to only apply to window focus. (Using MFC)
Thanks
u6ik
|
|
|
|
|
CButton::GetState
Nunc est bibendum
|
|
|
|
|
A button is also a window (in fact, every control derives from CWnd so every control is also a window). So GetFocus will work
|
|
|
|
|
Excellent... thanks all
u6ik
|
|
|
|
|
Dear all,
I wrote an MFC-Application in VC 6.0 which starts a batch-job. When I use
system("start_socet -single data_convert -batch -s C:\\temp\\settings.set");
it all works perfect, but displays me a command-window, every time a new job is started.
In order to avoid the window, I tried it with "CreateProcess" (see code below), but always get back, that the process wasn't able to open a file (MSDN Error-Code Nr. 2)! Does anybody have an idea how to solve this problem?
For your info: Start_socet is a MS-DOS Batch-File, data_convert is an executable which cannot be executed stand-allone!
STARTUPINFO siStartupInfo;<br />
PROCESS_INFORMATION piProcessInfo;<br />
memset(&siStartupInfo, 0, sizeof(siStartupInfo));<br />
memset(&piProcessInfo, 0, sizeof(piProcessInfo));<br />
siStartupInfo.cb = sizeof(siStartupInfo);<br />
int rc=CreateProcess(NULL, "start_socet -single data_convert -batch -s C:\\temp\\settings.set", 0, 0, false, CREATE_DEFAULT_ERROR_MODE, 0, 0, &siStartupInfo, &piProcessInfo);<br />
DWORD error=GetLastError();<br />
Best regards
Snore
|
|
|
|
|
You could read the batch file,
then pass the things written there to ShellExecute()
SkyWalker
|
|
|
|
|
Snore wrote:
...I tried it with "CreateProcess" (see code below), but always get back, that the process wasn't able to open a file (MSDN Error-Code Nr. 2)!
Which file is unable to be opened, start_socet or settings.set?
Have you considered fully-qualifying the application name (e.g., c:\\some_path\\start_socet.exe)?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Just an idea, you might be able to use _popen()?
FILE *_popen( const char *command, const char *mode );
I'm not sure if it opens a command window or not. Or if has the capabilities to execute a batch file.
But it could be worth checking up.
|
|
|
|
|
Hello guys,
thanks for your hints!
I tried _popen but id didn't work! The perfect solution was to fully qualify the application name, which is a surprise to me, but it works! Thanks a lot David! Here's the code:
int rc=CreateProcess(NULL, "start_socet.bat -single data_convert.exe -batch -s C:\\settings.set", 0, 0, false, CREATE_NO_WINDOW, 0, 0, &siStartupInfo, &piProcessInfo);
And for those who didn't know: There's a flag "CREATE_NO_WINDOW", which is only documented in MSDN online and hides the console-window in a very easy way (but not for Windows Me/98/95)!
|
|
|
|
|
hi,
i have a very elementary doubt that is can i create a class that is not derived from any of the MFC class ,and if yes how to .
thanx in advance
Farpointer
|
|
|
|
|
Yes of course ! If you create your class with ClassWizzard, you have a ComboBox in which you can choose 'Generic class' (or something like that )
|
|
|
|
|
but iam afraid wether thats for an generic CWnd ,thats wat i saw any way i will check it out again .
thanx
|
|
|
|
|