|
This is my first crack at Multithreading and I am going to do it on MFC.
I read that MFC has 2 types of threads (The User Interface Thread and The Worker Thread). Obvious one is for the GUI Message Queue and the other is for the programs internal Work. Now onto my question:
1). Since an MFC program already has a its main thread that does all the work when you open the program, could I just leave that as the GUI thread and make one more thread as the worker thread? Or Do I have to make one thread for each?
Thanks
|
|
|
|
|
|
Hi all,
I want to list all the computers in a local network.
Computers name or IP address.
And is there any way to send messages to a compuetr with its
mac address of its adapter?
Thanks.
|
|
|
|
|
dSolariuM wrote:
I want to list all the computers in a local network.
Computers name or IP address.
NetServerEnum<br />
NetServerGetInfo
dSolariuM wrote:
And is there any way to send messages to a compuetr with its mac address of its adapter?
Dunno Know about sending message with Mac Address but you send message using NetMessageBufferSend api if you know server name
[Vote One Here, Complete my Survey....]
Alok Gupta visit me at http://www.thisisalok.tk
"I Think Believe this Will Help"
|
|
|
|
|
Does anyone know where i can get the code to convert numbers to words using C++?
Looking for something basic, a few simple functions etc...
Example: "123"
"One hundred and twenty three"
|
|
|
|
|
Here are a few examples:
http://www.barasch.com/excel/cCo11432.htm
http://ourworld.compuserve.com/homepages/easysurf/cnvert18.htm
http://www.ozgrid.com/VBA/ValueToWords.htm
http://www.cs.bris.ac.uk/home/pehlivan/post/example/sec09.html
http://www.codeguru.com/Cpp/Cpp/algorithms/general/article.php/c9139/
http://www.google.com/search?hl=en&q=convert+numbers+to+words&btnG=Google+Search
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
I brought home an MFC project and am now wanting to take it back to work tomorrow. Problem is my CD burner wont copy the huge .pch files (in debug and release directory). It gets to that point and just stays there with no apparent progress. Will it be okay if I remove these .pch f iles from my copy here at home, take the rest of it to work and copy over the .pch files from friday which are at work?
Thanks,
sb
|
|
|
|
|
You almost never need to copy any of the files in your /Debug and /Release dirs, since they'll be recreated when you rebuild the project. The exceptions to this rule are third-party DLLs or application-specific data files that may need to exist in these dirs. So save yourself time (and CDs) and leave these bad boys alone!
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
|
Please see this code here I am trying to fill all the pixels of a particular color with black. The figure is irregular so I can't use any of the known fill functions. The problem here is that the processing stops after some time. Probably runs out of memory(as shown by an error when the same code was run in VB).
If anyone knows any fill function for an irregular object, or can debug this code suggest it.
Any help woul be appriciated.
void dlg::floodfill(int x, int y, int r , int g, int b)// x,y are pixel positions r,g,b are color components, pixels coloured with these have to be found and replaced
{
CClientDC dc(this);
COLORREF rgb,rgb1;
rgb=dc.GetPixel(x,y);
BYTE r1,g1,b1;
r1=GetRValue(rgb);
g1=GetGValue(rgb);
b1=GetBValue(rgb);
if((r1<r+20)&&(r1>r-20))
if((g1<g+20)&&(g1>g-20))
if((b1<b+20)&&(b1>b-20))
{
rgb=RGB(0,0,0);
rgb1=dc.SetPixel(x,y,rgb);
floodfill(x-1,y-1,r,g,b);
floodfill(x,y-1,r,g,b);
floodfill(x+1,y-1,r,g,b);
floodfill(x-1,y,r,g,b);
floodfill(x+1,y,r,g,b);
floodfill(x-1,y+1,r,g,b);
floodfill(x,y+1,r,g,b);
floodfill(x+1,y+1,r,g,b);
}
}
Awasthy
Any work worth doing is worth doing well.
|
|
|
|
|
Infinite (or extremely deep) recursion, perhaps?
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Try not to create the CClientDC object at each recursive call, but once, then call this:
<br />
void dlg::floodfill(CDC* pDC, int x, int y, int r , int g, int b)<br />
Hope this helps
|
|
|
|
|
For any non-trivial area of the screen, you're likely to run out of stack space.
You're also going to end up treating each pixel repeatedly.
See this article[^] for a good fill algorithm (judging by the ranking in Google's search results and the CP article rating of 4.71).
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
My program is able to show visual styles after adding a minfest described in smoe articles here.
But I want, that my programm always uses the windows xp style independently which style the user has chosen in the windows-settings. That means, that i want to change the visual style, but only for this program. Is that possible?
Gabriel
|
|
|
|
|
Unless you're writing something special like a theme browser (like in the Display control panel), please don't do this. User settings exist for a reason, software should follow those settings.
--Mike--
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
I can't seem to be able to draw an image using the CxImage library. My code is simply:
CxImage image;
HDC hdc=::GetDC(m_hWnd);
image.Draw(hdc);
Can anyone give the exact code for drawing an image?
|
|
|
|
|
i'm programming Type Assistant
i finished hook dll that can interrupt WM_KEYDOWN messages.But now,i don't know how to send words i iterrupted and after edited--->to window that a user is typing...
for a example:
when user opens notepad (or anything typing program) and type "boo",my program will search in Data and find a word having meaning.Example "book" and if user press Ctrl+Spacebar my program will add 'k' letter to notepad to make a meaning word "book".And here,i don't know how to add 'k'letter to notepad or anything other typing program.
sorry beacause my english ability is not good///
and thanks...
Here we go!!!
|
|
|
|
|
Hi,
You can use keybd_event or SendInput functions to do this.
Regards.
G.K.Z
King Zoser
|
|
|
|
|
Hi
ok i will try...thank you
|
|
|
|
|
hello friends
i want to make packet sniffer
plz help me how shld i start. plz guide me for making packet sniffer using c++.if anyone can send tutorial to make it than plz send it.
plz reply me soon
bye
|
|
|
|
|
You will need to write an intermediate NDIS driver, however I would not start one my self given there are free ones out there. Take a look at WinPCap[^]. That will give you a great start.
|
|
|
|
|
Hello,
I have an MFC dialog that is painted with a custom image background to provide it a jazzy look. Also, all the static labels are owner drawn, and in OnCtlColor I set a transparent background and return a null brush so that my bitmap background will be visible through.
However, I find that this is causing problems for a combo box with dropdown style that I have on the same dialog. If I directly type some text say "12345" into the edit portion of the combo box, and then choose a string "12" from the drop-down list, then the earlier 12345 continues to be visible in the edit portion!! really weird behavior.
I traced the problem down to ON_WM_CTLCOLOR. If I remove ON_WM_CTLCOLOR from the BEGIN_MESSAGE_MAP/END_MESSAGE_MAP entries, then the combo works perfectly normal, but I obviously cannot remove the WM_CTLCOLOR permanently.
Any help will be greatly appreciated, this is an urgent request please, this software will be released into the market within a week, and I am simply stuck after a lot of tryng to figure out whats wrong.
|
|
|
|
|
On further investigation, I noticed one more strange thing. Just above the problematic combo box, there is a radio button with id IDC_RADIO_LEFT.
My OnCtlColor has code like this:
if(pWnd->GetDlgCtrlID() == IDC_STATIC
|| pWnd->GetDlgCtrlID() == IDC_RADIO_LEFT
|| pWnd->GetDlgCtrlID() == IDC_RADIO_RIGHT
|| pWnd->GetDlgCtrlID() == IDC_CHECK_RESIZETOFIT
|| pWnd->GetDlgCtrlID() == IDC_CHECK_PLAYINSEQ
|| pWnd->GetDlgCtrlID() == IDC_CHECK_LOOP
|| pWnd->GetDlgCtrlID() == IDC_CHECK_PAUSEDATSTART
|| pWnd->GetDlgCtrlID() == IDC_CHECK_ENABLELINK
|| pWnd->GetDlgCtrlID() == IDC_STATIC_AFFILIATEID
)
{
// Set the background mode for text to transparent
// so background will show through.
pDC->SetBkMode(TRANSPARENT);
// Return handle to our CBrush object
//hbr = m_brush;
return (HBRUSH)::GetStockObject(NULL_BRUSH);
}
Now if i remove the line
|| pWnd->GetDlgCtrlID() == IDC_RADIO_LEFT
from the if condition, the combo box works fine.
|
|
|
|
|
Well, I got a kind of hack that fixed the problem.
By default, the id for IDC_RADIO_LEFT was #defined as 1001 in the auto-generated resource.h file. I changed this to some other value (5000) and I no longer get the problem.
Probably the ID for the edit portion of the combo box was also 1001 by default, and this was causing problems in the OnCtlColor method.
Hope this helps someone.
Best regards,
~Ambar.
|
|
|
|
|
hello friends
plz help me by sending a source code of packet sniffer using console programming in vc++, or using c++. or some help regarding sniffer.
thanx
bye
|
|
|
|
|