|
hell_admin wrote: I need to assign my App to some protocol like this:
I am on a website that contains <A HREF="someprotocol://someaddr">
it will load the program and pass this as the command line
This is just a guess, but try merging the following into your registry:
[HKEY_CLASSES_ROOT\someprotocol\shell\open\command]
@="\"C:\\Program Files\\somefolder\\someprog.exe\" %1"
|
|
|
|
|
You're not so far from the truth
here's result maybe someone needed:
bool SetMoniker()
{
CString url = _T("your protocol");
CString def = _T("URL:someproto"); //can change after URL:
TCHAR app_path[_MAX_PATH+1]=_T("\0");
GetModuleFileName(NULL,app_path,_MAX_PATH);
CString icon(app_path);
icon += _T(",0");
CString command(app_path);
command = _T("\"") + command + _T("\"");
command += _T(" \"%1\"");
HKEY key;
if (ERROR_SUCCESS == RegCreateKeyEx(HKEY_CLASSES_ROOT,_T("someproto"),0,0,REG_OPTION_NON_VOLATILE,KEY_WRITE,0,&key,0))
{
RegSetValueEx(key,_T("URL Protocol"),0,REG_SZ,(BYTE*)url.GetString(),(DWORD)( url.GetLength()*sizeof (TCHAR)) );
RegSetValueEx(key,NULL,0,REG_SZ,(BYTE*)def.GetString(),(DWORD)( def.GetLength()*sizeof (TCHAR)) );
HKEY icon_key;
if( ERROR_SUCCESS == RegCreateKeyEx(key,_T("DefaultIcon"),0,0,REG_OPTION_NON_VOLATILE,KEY_WRITE,0,&icon_key,0))
{
RegSetValueEx(icon_key,NULL,0,REG_SZ,(BYTE*)icon.GetString(),(DWORD)( icon.GetLength()*sizeof (TCHAR)) );
RegCloseKey(icon_key);
}
HKEY com;
if( ERROR_SUCCESS == RegCreateKeyEx(key,_T("shell\\open\\command"),0,0,REG_OPTION_NON_VOLATILE,KEY_WRITE,0,&com,0))
{
RegSetValueEx(com,NULL,0,REG_SZ,(BYTE*)command.GetString(),(DWORD)( command.GetLength()*sizeof (TCHAR)));
RegCloseKey(com);
}
RegCloseKey(key);
return true;
}
return false;
}
|
|
|
|
|
Hello:
I want to change wma to wav,I find it difficult.
Who know the source code about it, pls tell me.
Thanks
|
|
|
|
|
you asked this 2 hours ago... wait a little dude
|
|
|
|
|
toxcct wrote:
tooo -> good .. atleast you stop getting mad!
"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 guess that he dont ask this question again because he knows you are here
|
|
|
|
|
it's not what he should tell himself
people post because they have a question to ask... but once the thread is started, you have to continue to discuss on the same thread, not asking and asking until you get a response
|
|
|
|
|
Hello i'm using a neverending loop to read informations from the COM but the problem is that the reading process blocks my aplication. Not to listen to the COM all the time is not an option. What should I do to use the aplication in this time?
|
|
|
|
|
Can you put the reading process in a thread?
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
I don't get it. What do you mean? Be more specific, please.
|
|
|
|
|
tanarnelinistit wrote:
neverending loop to read informations from the COM
Why don't you put this loop inside a thread function to read the COM port>?if you do so you can keep on reading the COM port in the thread and leave your main application's thread working.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Create a worker thread and put your
<br />
do<br />
{<br />
}while;<br />
loop inside the Thread function.
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
I dont know why the hell the script for voting 5 is disabled only for me??
|
|
|
|
|
and how do i create a worker thread?
|
|
|
|
|
simple... Follow these steps :
you have a function. ReadCOM() . You dont want this to block your application.
declare these in your header may be COMPROG.h
<br />
static UINT MyThread(LPVOID lp);<br />
void ReadCOM();<br />
in the implementation,
COMPROG.cpp<br />
AfxBeginThread(MyThread,this);
Your Thread:
<br />
UINT MyThread(LPVOID lp)<br />
{<br />
CCOMPROG* obj = (CCOMPROG*)lp;
obj->ReadCOM(); <br />
}<br />
Your Fcuntion:
<br />
void ReadCom()<br />
{<br />
do<br />
{<br />
}while(x==true);
}<br />
|
|
|
|
|
Thanks a lot I folowed your code but ended up with the folowing error message : error C4716: 'CMina_sView::MyThread' : must return a value; i tryed to insert a return 0 or return TRUE but that wasn't much of a help as I got the same result: program blocked. so??!?
|
|
|
|
|
it has a return type of UINT
so do this, I missed it
return(0); Now it should work. Otherwise you tell me. we'll kill it.
also that , when you put your "readCOM()" function inside the class,
implement it with your class(CCOMPROG) refernce like void CCOMPROG::readCOM()
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
I dont know why the hell the script for voting 5 is disabled only for me??
|
|
|
|
|
I'm afraid someone will have to get killed. ) Let me tell you how i modified your code:
1) I use an OnListenComm() function that is as the name tells us: a function auto-defined by VC++ that handles the code when you click on listencom button.
2)The modifications:
static UINT MyThread(LPVOID lp);
afx_msg void OnListenCom1();
AfxBeginThread(MyThread,this);// Where should i put this???????
UINT CMina_sView::MyThread(LPVOID lp)
{
CMina_sView* obj = (CMina_sView*)lp; //To access the ReadCOM function, or you can pass any function, with using the void pointer.
obj->OnListenCom1();
return 0;
}
|
|
|
|
|
It depends on when you want to start the thread. For example, you have CButton , If you wanna start listening to COM on the click of it, put the AfxBeginThread inside the OnClick Event of the CButton. You can do that anywhere.
<marquee scrollamount="1" scrolldelay="1" direction="up" height="10" step="1">--[ ]--
[My Current Status]
I dont know why the hell the script for voting 5 is disabled only for me??
|
|
|
|
|
|
Read here.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
You can also poll the COM port; this isn't necessarily the nicest design, but it may work. See the function SetCommTimeouts to set read timeouts. In fact, you may want to do this in either case; your thread can block reading the port and wake up every 1s to check if it is time to quit the application.
Save yourself a bunch of hassle and do a bit of reading about thread safety issues now before you do a bunch of work.
earl
|
|
|
|
|
Hi,
I am a newbie to image processing and c++. Actually, i have a web cam running, i need to snap shot consecutive pictures and convert each picture into a 2D array storing intensity(integer).
If i have 2 picture namely picture 1 and picture 2:
Picture 1 -- First 2 D array
Picture 2 -- Second 2D array
A comparison have to be done with the two 2 D array to find the differences.
I have no idea on how should i start the project, anyone can assist me pls?
Thanks
|
|
|
|
|
Look at the Api BITMAPINFO AND BITMAPFILEHEADER in MSDN and also the book windows programming by charles petzold.In the book look into BITMAPINFO and BITMAPFILEHEADER apis.
|
|
|
|
|
Try searching CodeProject for "video capture" or "webcams" - look for a sample application which captures frames of video to memory.
If you set the webcam / capture routine to capture 8-bit Black & White (monochrome), these captured images are really just 2D arrays of intensity (for 8-bit monochrome, each pixel is an intensity value in the range 0 to 255.)
If you capture in colour, you will have to convert the colour information of each pixel to an equivalent intensity value. I'd guess there are libraries to do that sort of thing.
Find a suitable project to start with, try playing around, then ask specific, detailed questions about any problems you encounter.
|
|
|
|
|