|
Thanks for the reply,
the binary image is a picture of a boat. The boat has an arbitrary shape. And the file is a bmp file.
Franck
|
|
|
|
|
Hi,
I guess this problem can be solved by 4/8 connected components alogorithm. do a runlength encoding of image
and perform a depth first search to find connected components , from that you can identify holes.
Regards,
Shiju
|
|
|
|
|
First find the hole, then search in an expanding spiral to find the hole's bounds.
Searching every pixel in the image is slow. If you have any advance knowledge about the image and hole, you can use this to speed up the search.
For example, if you know the hole will be over 10 pixels wide, you can search every 10th pixel, looking for the hole. This will speed up your search by a factor of 10.
|
|
|
|
|
Hi,
I have created a little custom CListCtrl that uses CComboBox and CEdit.
I need to use my edit control for displaying a path.
Is it possible to add the browse option, i.e. when the edit control is selected a browse button appears at the end of the Edit Control?
TIA
Tony
|
|
|
|
|
You should be able to create an owner drawn edit control in which you can handle its WM_PAINT message and show the button.
|
|
|
|
|
I am trying to play (synthesize) some notes when user presses keyboard keys.
I use midiOutShortMsg from mmsystem.h to play notes, but there is an audible delay (about 0.1 sec) before sound starts playing.
I've heard of DirectMusic, but it is deprecated and I can't find any download link for DirectX 8 (which was the last release containing it).
Is there any workaround?
|
|
|
|
|
In case anyone is interested, I solved this problem using ASIO. There is a free driver, ASIO4ALL, that suits almost any audio card (in case your native driver does not support ASIO). The delay is unaudible now.
|
|
|
|
|
This question sounds silly.. but i am confused. i wanted to know what is the order in which the classes are called in an SDI Application.
|
|
|
|
|
Broadly speaking I think it goes like this: the CApp() derived class is created first and that then creates the CMainFrame which creates the CView . The CDocument() is then created by the framework and connected to the view. You can use the debugger to step through your application to see exactly what is the sequence of events. Don't forget to put breakpoints in the proper places so you can quickly skip over all the framework code.
[edit]spelling[/edit]
|
|
|
|
|
you can set MessageBox in your code and you will get the order,for example:
you set a messagebox in your VIEW CLASS of LBUTTONDOWN function,set messagebox in your DOC CLASS of LBUTTONDOWN function,and set a messagebox in your APP CLASS of LBUTTONDOWN function,you click the program's client,the
view box will display,then you remove the VIEW MESSAGEBOX ,then click the program's client,DOC MESSAGEBOX display........
|
|
|
|
|
creating simple dilog box without using resource script...please help urgent requitement
kir_MFC
|
|
|
|
|
This is the third time you have asked this question (or a variation of it). Try reading the documentation on MSDN[^], and using one of the examples.
|
|
|
|
|
Just check this link. [^]
Величие не Бога может быть недооценена.
|
|
|
|
|
In addition... To check this[^] won't hurt you.
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
|
please let me know the procedure of creating modelessdilog box dynamically
kir_MFC
|
|
|
|
|
The procedure in your previous post is the correct way.
You should try the suggestions given there and follow up on that instead of posting the question again.
|
|
|
|
|
i use InternetOpenUrl (as async) to receive a file from a url.
this is the code i use :
BOOL CMyCode::RequestFile( LPCTSTR lpszUrl )<br />
{<br />
m_hInternet = InternetOpen(_T("MyCode"), INTERNET_OPEN_TYPE_DIRECT, NULL, NULL, INTERNET_FLAG_ASYNC);<br />
if (!m_hInternet)<br />
{<br />
return FALSE;<br />
}<br />
<br />
InternetSetStatusCallback(m_hInternet, CMyCode::InternetStatusCallback);<br />
<br />
InternetOpenUrl(m_hInternet, <br />
lpszUrl, <br />
NULL,<br />
0, <br />
INTERNET_FLAG_RELOAD | INTERNET_FLAG_PRAGMA_NOCACHE | INTERNET_FLAG_NO_CACHE_WRITE, <br />
(DWORD) this);<br />
return TRUE;<br />
}<br />
<br />
void __stdcall CMyCode::InternetStatusCallback (HINTERNET hSession, DWORD Context, DWORD Status, LPVOID pInformation, DWORD InfoLength)<br />
{<br />
CMyCode* pThis = (CMyCode*) Context;<br />
if (!pThis)<br />
{<br />
return;<br />
}<br />
<br />
switch (Status) <br />
{<br />
case INTERNET_STATUS_RESPONSE_RECEIVED:<br />
m_dwNumytes2Read = (*(DWORD *)pInformation);<br />
break;<br />
case INTERNET_STATUS_HANDLE_CREATED:<br />
m_hHttpSession = * (HINTERNET *) pInformation;
break;<br />
case INTERNET_STATUS_REQUEST_COMPLETE:<br />
CompleteRequest();<br />
break;<br />
case INTERNET_STATUS_HANDLE_CLOSING:<br />
break;<br />
default:<br />
ATLTRACE(_T("Status is %ld\n"), Status);<br />
break;<br />
} <br />
}<br />
<br />
void CMyCode::CompleteRequest()<br />
{<br />
LPBYTE pBuff = new BYTE[m_dwNumytes2Read];<br />
ZeroMemory(pBuff, m_dwNumytes2Read);<br />
<br />
DWORD dwBytesRead(0);<br />
BOOL bOK(TRUE);<br />
while (bOK)<br />
{<br />
bOK = InternetReadFile (m_hHttpSession, pBuff, m_dwNumytes2Read, &dwBytesRead);<br />
if (!dwBytesRead)<br />
bOK = FALSE;<br />
}<br />
<br />
if (pBuff)<br />
delete []pBuff;<br />
<br />
Abort();<br />
<br />
}<br />
<br />
the code works ok only i have 2 major problems:
1. the file is received in a chunks of 267/268 Bytes each time i call InternetReadFile????
2. the CPU reaches 80% until the file is download completely
can any1 help me here?
thanks in advanced
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|
|
You can try URLDownloadToFile function.
|
|
|
|
|
thanks for the reply...
i can not use other methods other than what i've posted in my code (for stupid reasons go figure)
so i would still like any help regarding my issues
thanks again
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|
|
YaronNir wrote: i can not use other methods other than what i've posted in my code (for stupid reasons go figure)
so i would still like any help regarding my issues
Then You're at a dead end! We cannot help you any further!(for stupid reasons go figure).
Bram van Kampen
|
|
|
|
|
this sort of reply is in appropriate,
if you can see below i got a really good reply who took my question seriously
shame on you....
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|
|
Have you checked the value of m_dwNumytes2Read bfore your call to InternetReadFile() ?
|
|
|
|
|
what do you mean? can you give an example
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|
|
You have the following code (btw could you edit your original message and put the code between <pre></pre> tags):
case INTERNET_STATUS_RESPONSE_RECEIVED:
m_dwNumytes2Read = (*(DWORD *)pInformation);
break;
void CMyCode::CompleteRequest()
{
LPBYTE pBuff = new BYTE[m_dwNumytes2Read];
ZeroMemory(pBuff, m_dwNumytes2Read);
DWORD dwBytesRead(0);
BOOL bOK(TRUE);
while (bOK)
{
bOK = InternetReadFile (m_hHttpSession, pBuff, m_dwNumytes2Read, &dwBytesRead);
}
The value of m_dwNumytes2Read is set when you process the INTERNET_STATUS_RESPONSE_RECEIVED message and is relevant to the status information, so it is probably less than the amount of data that may be available. Try resetting it to some bigger value before calling InternetReadFile() for example:
dwNumytes2Read = 2048;
LPBYTE pBuff = new BYTE[m_dwNumytes2Read];
DWORD dwBytesRead;
BOOL bOK(TRUE);
while (bOK)
{
bOK = InternetReadFile (m_hHttpSession, pBuff, m_dwNumytes2Read, &dwBytesRead);
|
|
|
|