|
:-OI am developing a MFC application( SDI and style is explorer.) I want the list of all the computers (systems ) if whole network ?
I need to make a similiar applicaion like "Network Neigbourhood"
ie. how to list all the n.w
Is there any feature available in VC++ for this ???
|
|
|
|
|
I've just had a quick look, and the article
Enumeration of Computer Names and their IP address
[^]
looks like it may be what you want.
If you want to browse for a computer,
SHBrowseForFolder () with a flag of BIF_BROWSEFORCOMPUTER will
give you what you want. You can use SHGetSpecialFolderPath (CSIDL_NETWORK)
to get the PIDL of Network Neighbourhood.
Good luck,
Iain
|
|
|
|
|
I've searched the Internet and found no help on this particular subject. I need to justify my text so as both the left and right margin are aligned. I can do left align, right align and centering but unable to do justify. Can anyone please help. Thank you in advance!
|
|
|
|
|
I have a class derived from CRichEditCtrl, and am attempting to set its default font by filling CHARFORMAT's yHeight and calling CRichEditCtrl::SetDefaultCharFormat, but I can't seem to find an actual way to convert my value (which is in points) to the value it needs ("twips", apparently) to match the size of the font when used in other areas of my client screen (multiplying the pts value by ten causes it to be around the same size, but it seems bold, for example).
Can anybody pass down a little wisdom on this idea? I'm at somewhat of an impasse in that branch of my project. Thanks.
- Jason
(SonorkID 100.611)
The Code Project - Orange makes the art grow fonder
|
|
|
|
|
how about using yHeight=points*12 and dwEffects=0 ?
|
|
|
|
|
From the CHARFORMAT docs - - yHeight
- Character height, in twips (1/1440 of an inch or 1/20 of a printer's point).
So 20 twips == 1 point.
--Mike--
The Internet is a place where absolutely nothing happens.
-- Strong Bad
1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
I tried yours and Moak's suggestions, but the text is still in bold. Any further ideas? Thanks for helping, and especially for taking the time to go and dig that up from the MSDN.
- Jason
(SonorkID 100.611)
The Code Project - Orange makes the art grow fonder
|
|
|
|
|
Nevermind, thanks.. got it
- Jason
(SonorkID 100.611)
The Code Project - Orange makes the art grow fonder
|
|
|
|
|
Hi,
I have a simple button in a dialog box. I want to paint a bitmap on the button. I created the bitmap in Resource Editor. It is ready to be imported to the program.
How do you paint a bitmap to a button?
I tried SetBitmap(), but it wants an HBITMAP structure.
Thanks,
Kuphryn
|
|
|
|
|
|
use LoadImage() to load the bitmap resource.
m_hBitmap = (HBITMAP)LoadImage (AfxGetInstanceHandle(),
MAKEINTRESOURCE (IDB_MYBITMAP),
IMAGE_BITMAP,
0,
0,
LR_DEFAULTCOLOR);
if (m_hBitmap)
m_MyButton.SetBitmap(m_hBitmap);
CPUA 0x5041
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!
|
|
|
|
|
Nice! Thanks.
I implemented your code. However, Window would not paint the bitmap onto the button. Maybe I did something wrong.
Kuphryn
|
|
|
|
|
Okay. I made a mistake and did not set the button to process accept bitmap.
Thanks again.
Kuphryn
|
|
|
|
|
Hi,
I use pDC->ExcludeClipRect(rectItems) to exclude a part of the client area being painted. This should be temporary and I like to add the rectangle again (restore previous clipping region)....
...but there is no CDC::IncludeClipRect() ?
Prolly I should work with help of SaveDC/RestoreDC instead, what do you think?
Thanks for help
Moak
|
|
|
|
|
Use CDC::ExtSelectClipRgn, this will add the new rgn that you specify to the existing clipping region. You may also want to check out a tutorial that I wrote on ^].
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Okie thanks, I'll have a look on it!
|
|
|
|
|
Hey, I'm a beginner at programming. I just read a tutorial on Combo Boxes and I now want to use the string of the selected option in a different function. How can I do this?
Heres the code for the combo box function.
void CAlertmakerDlg::OnSelchangeFont()
{<br />
UpdateData(); <br />
<br />
if( m_fontnumber < 0 ) return;
<br />
CString str;<br />
m_fontlist.GetLBText( m_fontnumber, str );<br />
}<br />
|
|
|
|
|
Never mind, I found out.
Instead of using:
<br />
CString str;<br />
m_fontlist.GetLBText( m_fontnumber, str );<br />
I should have been using:
<br />
m_fontlist.GetLBText( m_fontnumber, m_fontname );<br />
m_fontname is defined earlier in the program.
|
|
|
|
|
I have a program that calculates an exponent recursively. It's time complextity is O(n lg n). I would like to know whether anybody knows how I can improve my program to make it into a O(lg n) program. Please help!!!
here is my code:
#include <iostream.h><br />
#include <math.h><br />
#include <ctime><br />
<br />
void PersonalDisplay(void);<br />
int powerNOTRECURSIVE(int x, unsigned n);<br />
int powerRECURSIVE(int n, int k);<br />
<br />
void main(void){<br />
<br />
<br />
long ans=0;<br />
long base=0;<br />
long exponent=0;<br />
<br />
clock_t startclock = 0;<br />
clock_t endclock = 0;<br />
<br />
<br />
<br />
cout<<endl;<br />
<br />
cout<<"Enter the base: "<<endl;<br />
cin>>base; <br />
cout<<endl;<br />
cout<<"Enter the exponent: "<<endl;<br />
cin>>exponent; <br />
cout<<endl;<br />
<br />
<br />
cout<<"Calling the RECURSIVE function...."<<endl;<br />
startclock = clock();
ans=powerRECURSIVE(base,exponent);<br />
endclock = clock();
cout << "NonRecursive Time: " << (endclock-startclock) << endl;<br />
cout<<ans;<br />
}<br />
<br />
int powerRECURSIVE(int n, int k){<br />
if(k==0) return 1;<br />
int m=k>>1;<br />
int z=powerRECURSIVE(n,m)*powerRECURSIVE(n,m);<br />
if(k && 1)return z*n;<br />
return z;<br />
}
GabyGirl
|
|
|
|
|
I don't really know what you mean by O(n lg n): which n are you talking about? Anyway, powerRECURSIVE can be greatly improved by replacing
int z=powerRECURSIVE(n,m)*powerRECURSIVE(n,m);
with
int z=powerRECURSIVE(n,m);
z=z*z;
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
On my recursive function, I made a mistake:
GabyGirl wrote:
int z=powerRECURSIVE(n,m)*powerRECURSIVE(n,m);
if(k && 1)return z*n;
return z;
I meant [BITWISE AND]
if(k&1) return z*n;
excuse the inconvenience....
GabyGirl
|
|
|
|
|
Where is this program in n lg n ?
I think the main point here should be the calculation by multiplication, but your function gets the base as n ?
So isn't it in O(1) considering n ?
When I look at k it's already in O(lg k). Everytime the recursive function is called m=k>>1 makes the new exponent 1/2 the size. So it should be in O(lg k)
If you think that it is in O(k lg k) because of the times that you measured, then it's just because of the line that Joaquin already pointed out.
WIthout that correction you'd win nothing, because the function does get called twice calculating the same result twice.
|
|
|
|
|
I was wondering I see many registry classes and such for to write to registry, read registry, ect. However I have never seen any code on how to search the registry for differn't values like lets say I wanted to search tne enitre registry for a key name or specific data how would you go about doing that?
- LiquidKnight
|
|
|
|
|
When you record a CD on a CD-R, the cd gets a serial number which changes from one to another.
Is there a way to copy/image/duplicate a CD with the same serial number?
Regards,
Sassan
|
|
|
|
|
I hope you're not trying to pirate something.
CloneCD will do it. google.
#include <beer.h>
|
|
|
|