|
1) Yes. (SDI CFormView might be a choice as well, but that depends on how complex you want things)
2) Yep, that is a reasonable choice.
3) When it comes to this question, I'm not too sure.
Happy Programming and God Bless!
WWW::CodeProject::BNEACETP
|
|
|
|
|
CWnd::DlgDirList() will populate a list box with the names of files in a directory. But if you want a more professional look, use PJN's CTreeFileCtrl[^] to display files and folders.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
i want to allow a user to enter a website address (eg. www.microsoft.com) into a text box
and i can then resolve this address to its IP address.
i am sure there is a function for this,
but i cannot find it
thanks
|
|
|
|
|
Hi,
You can use "accept(hSocket,(struct sockaddr*)&stcSockaddrCln,&iSocketSize)" in order to accept incoming request. If you want to resolve dns to ip number, you may use "inet_ntoa(stcSockaddrCln.sin_addr)".
I hope it's good enough for you.
Regards,
Orkun Gedik
Ahmet Orkun GEDiK
System & Software Support Specialist (SAP R/3)
ASTRON
|
|
|
|
|
This function is the one you r looking for---->
gethostbyname
The Windows Sockets gethostbyname function retrieves host information corresponding to a host name from a host database.
struct hostent FAR *gethostbyname(
const char FAR *name
);
Parameters
name
[out] Pointer to the null-terminated name of the host to resolve.
Return Values
If no error occurs, gethostbyname returns a pointer to the HOSTENT structure described above. Otherwise, it returns a NULL pointer and a specific error number can be retrieved by calling WSAGetLastError.
Error code Meaning
WSANOTINITIALISED A successful WSAStartup call must occur before using this function.
WSAENETDOWN The network subsystem has failed.
WSAHOST_NOT_FOUND Authoritative answer host not found.
WSATRY_AGAIN Nonauthoritative host not found, or server failure.
WSANO_RECOVERY A nonrecoverable error occurred.
WSANO_DATA Valid name, no data record of requested type.
WSAEINPROGRESS A blocking Windows Sockets 1.1 call is in progress, or the service provider is still processing a callback function.
WSAEFAULT The name parameter is not a valid part of the user address space.
WSAEINTR A blocking Windows Socket 1.1 call was canceled through WSACancelBlockingCall.
Remarks
The gethostbyname function returns a pointer to a HOSTENT structure—a structure allocated by Windows Sockets. The HOSTENT structure contains the results of a successful search for the host specified in the name parameter.
The application must never attempt to modify this structure or to free any of its components. Furthermore, only one copy of this structure is allocated per thread, so the application should copy any information it needs before issuing any other Windows Sockets function calls.
The gethostbyname function cannot resolve IP address strings passed to it. Such a request is treated exactly as if an unknown host name were passed. Use inet_addr to convert an IP address string the string to an actual IP address, then use another function, gethostbyaddr, to obtain the contents of the HOSTENT structure.
The gethostbyname function resolves the string returned by a successful call to gethostname.
Requirements
Version: Requires Windows Sockets 1.1 or later.
Header: Declared in Winsock2.h.
Library: Use Ws2_32.lib.
Remember... testing & debugging are always part of programming ...so exterminate those stinking bugs
|
|
|
|
|
How I can send data on seven segment through parallel port
keep it up
|
|
|
|
|
If the parallel port address is 0x378 then:
char data=0xaa;
_outp(0x378, 0xaa);
Now 0xaa will be sent to parallel port.
A. Riazi
|
|
|
|
|
I have a text file with pdf code. I need to save it as a true binary file for pdf to read it correctly. I believe in a mac format. Does anyone know the functions I can use to open and write to a binary file in c++?
Thanks,
Nick
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
to open and write into a binary file do the following:
<br />
FILE* f;<br />
<br />
f = fopen("my_binary_file.bin", "wb");<br />
<br />
fwrite(buffer, 16, 1, f);<br />
<br />
fclose(f);<br />
|
|
|
|
|
yeah I forgot it was so easy. thanks
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
I'm searching for a method to verify if the cd-rom door is opend or closed... Any method... Does somebody knows ?...
Thanks
|
|
|
|
|
the os does this by polling the drive with TEST_UNIT_READY opcodes.
Don't try it, just do it!
|
|
|
|
|
Thank you for the answer. But can you give me an example how to use this?.. I want to test this in a mfc application; for example what I have to write in a BOOL function to recive true for open door and false for a closed cdrom door?...
10x very much!
|
|
|
|
|
Is there a c++ API or anything in the MFC library that allows you to input a text string and it speaks the text out loud? Doesn't windows come with a built in text to speech engine, as I can change the properties for it in the control panel?
If not does anybody know how to achieve text-speech translation?
Thanks
|
|
|
|
|
|
|
|
I'm using a CBitmap and a memory device context for a basic animation
Why does the screen turn black?
void CtennisView::OnTimer(UINT nIDEvent)
{
CClientDC dc(this);
OnPrepareDC(&dc);
curtime+= 0.05f;
CRect rect;
GetClientRect(&rect);
CPoint pl(0,0),ps(rect.Width(),rect.Height());
dc.DPtoLP(&pl);
dc.DPtoLP(&ps);
CDC memdc;
memdc.CreateCompatibleDC(&dc);
CBitmap bitmap;
bitmap.CreateCompatibleBitmap(&dc,rect.Width(),rect.Height());
memdc.SelectObject(&bitmap);
OnPrepareDC(&memdc);
DrawBall(&memdc,ballptnew);
UpdatePos();
dc.BitBlt(pl.x,pl.y,ps.x-pl.x,ps.y-pl.y,&memdc,pl.x,pl.y,SRCCOPY);
DrawBall(&memdc,ballptnew);
UpdatePos();
CView::OnTimer(nIDEvent);
}
|
|
|
|
|
Well lets see you create an empty bitmap the size of the client area and then you draw a ball to it and blit it to the client area. Why you are calling OnPrepareDC() here I have no idea. DrawBall() may not be drawing the ball to the memdc; if so then you would have a black screen.
Basicaly the code in the OnTimer function should look something like this:
void CtennisView::OnTimer(UINT nIDEvent)
{
CRect rect;
if( m_ball.GetRect(&rect) )
InvalidateRect(&rect);
m_ball.UpdatePos();
if( m_ball.GetRect(&rect) )
InvalidateRect(&rect);
UpdateWindow();
}
Well I hope this helps a little.
Good Luck!
INTP
|
|
|
|
|
Hi,
We have created this Group, 'CUIPL Mailing Group', which we think
you might also be interested in.
CUIPL is an Image Processing Library written in ANSI C++ in order to
be platform independent.
We thought that it would be more useful if we put it on the internet
as an open source, this way people can use it, but most important
they can extend it to cover areas not covered in the initial release.
This library is intended to be a tiny step towards a huge arabian
open soucre community, where we can build the software we need.
We don't have to rely on the west to supply us with - at least - our
software needs, we can do our own, and we are old enough to do so
we have the knowledge, experties, and the tools to achieve our goal.
So,
WHAT ARE WE WAITING FOR!!?
the group address is
http://www.smartgroups.com/groups/cuipl
Email us back if you need any help, or what it's all about...
Regards
Ahmed Mohamed Abdelsalam am_abdelsalam@msn.com
Mohamed Galal El-Din Mohamed eng_mg@yahoo.com
|
|
|
|
|
Hiya, I think I'm just being dumb, but I'm having a hard time deciding exactly where to change the font, size, etc. for controls on my form.
I have an MDI project with CFormView as its base; nothing very complicated, basically just a label at the moment anyways.
I'd like the label to not be 8 point times or whatever; but that's not doable visually for some reason (like it is in VB for Excel or what have you). I gather I want to use CWnd::SetFont which should be a member of my IDC_STATIC control, but VC++ seems to disagree with my placing of the function.
I don't doubt it's just been too long since I used VC++ to remember something this obvious ... TIA
-Joe
|
|
|
|
|
I recommend using
http://www.codeproject.com/staticctrl/clabel.asp[^]
It gives you a great deal of flexibility over static controls.
Michael
But you know when the truth is told,
That you can get what you want or you can just get old,
Your're going to kick off before you even get halfway through.
When will you realise... Vienna waits for you? - "The Stranger," Billy Joel
|
|
|
|
|
All static controls share the common control ID IDC_STATIC . IMHO, if you need to change the font, size, etc. of static controls at run-time, the first step is to change the control ID from IDC_STATIC to something more meaningful e.g. IDC_STATIC_NAME and then in your dialog's OnInitDialog , create a CFont , and use CWnd::SetFont to apply the changes.
Gurmeet S. Kochar
If you believe in God, it's because of the Devil
|
|
|
|
|
Hi..
what can i use to know the language of string like if it English or Arabic?
|
|
|
|
|
code an algorithm on your own, I've never heard of any other way.
Don't try it, just do it!
|
|
|
|