|
Ehh, have I understood you correctly; you're building user mode applications with the Driver Kit?
I don't say it's impossible since I think it's the same compiler and linker, but I would consider the environment the wrong tool for the job.
Do you have an existing installation of some Visual Studio version?
Otherwise I doubt you even have the file you're trying to include on your disk.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
yes, i have visual studio 6 and SDK installed on the 98 system.
I am want a spin control on my printer driver UI.
I am getting the error :
CSpinButtonControl : undeclared identifier.
and I read in msdn that afxcmn.h header is for mfc common control.
so, i tried including the header, now it is giving this error.
fatal error C1083: Cannot open include file: 'afxcmn.h': No such file or directory
|
|
|
|
|
tenwang wrote: I read in msdn that afxcmn.h header is for mfc common control.
That's correct, but are you building with support for the MFC framework?
Do you include e.g. afxwin.h anywhere in your source code?
I'm not sure I can help you further, I've never built anything user mode related with any WDK/DDK.
Furthermore I'm not sure what you're trying to do; you're talking about a "printer driver UI", but a driver doesn't have a UI. You may mean a Control Panel application meant to control the driver settings and if that's the case you can check out the WDM sample "Sample Audio Control Panel Application" in the WDK help.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
what i mean was, user interface for the printer driver, i need a spin control for various edit controls, like one for entering no. of copies to be printed.
afxwin.h is included in my code, the thing is that, my code works without error in xp, using wdk environment.
as i m using(i have to) DDk for 98, so i m facing this problem.
|
|
|
|
|
afxcmn.h and afxwin.h are located in the same directory, so if you can successfully include afxwin.h you shouldn't have any problem finding the afxcmn.h file.
Try building without the CSpinButtonCtrl and see if this is the only include problem you have and to verify that you can successfully include the afxwin.h file.
I assume you've included the file by writing...
#include <afxcmn.h> ...and not...
#include "afxcmn.h" ...so the compiler can search the include path instead of assuming the file is located in the project directory.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Yes, I used #include <afxcmn.h>, and i tried without CSpinButtonCtrl in my code, the it gives error for the header file.
I am using afxwin.h since long time back, and i have been using mfc classes like cbutton and cdialog without any hitch.
only after the problem with the CSpinButtonCtrl, i included afxcmn.h. I think, ddk is not having a library which wdk has.
thanks for ur concern...
|
|
|
|
|
I have used the below code to determine the Host Name of the local machine in which the application is running. gethostname() function returns SOCKET_ERROR. The same code works fine in another application. Pls tell me why it is not working in my application. Should I change any Project settings.
SOCKADDR_IN sockAddr;
memset(&sockAddr,0,sizeof(sockAddr));
CString rSocketAddress;
LPHOSTENT lphost;
char HostName[80];
if (gethostname(HostName, sizeof(HostName)) == SOCKET_ERROR)
{
AfxMessageBox(WSAGetLastError());
PostQuitMessage(WM_QUIT);
}
//_tcscpy(mInstSess[ind].INSHost,HostName);
m_sInsHost = HostName;
lphost = gethostbyname(HostName);
if (lphost != NULL)
{
sockAddr.sin_addr.s_addr = ((LPIN_ADDR)lphost->h_addr)->s_addr;
rSocketAddress = inet_ntoa(sockAddr.sin_addr);
//strcpy(mInstSess[ind].INSIP,rSocketAddress);
m_sInsIP = rSocketAddress;
}
Thanks in advance
Anusuya
Anu
|
|
|
|
|
Anu_Bala wrote:
if (gethostname(HostName, sizeof(HostName)) == SOCKET_ERROR)
{
AfxMessageBox(WSAGetLastError());
PostQuitMessage(WM_QUIT);
}
So what does WSAGetLastError() tell you?
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
It simply printed m in the messagebox
The function returned -1
Anu
|
|
|
|
|
Anu_Bala wrote: The function returned -1
What? -1?
Here are the error codes and I don't see -1 in it: Windows socket error codes[^]
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
AfxMessageBox() takes either a string to display, or a resource ID corresponding to a post in the string table as argument.
Since you're passing the return value from WSAGetLastError() , which is an integer value, the AfxMessageBox() function will try to load the string that matches that ID from the string table. Likely that ID does not exist in the string table and the call fails, hence the "-1".
Assign the return value from WSAGetLastError() to a variable and debug your code.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Anu_Bala wrote: AfxMessageBox(WSAGetLastError());
WSAGetLastError() returns an integer and you are passing it on to AfxMessageBox() . Talk about horror.
Many are stubborn in pursuit of the path they have chosen, few in pursuit of the goal - Friedrich Nietzsche
.·´¯`·->Rajesh<-·´¯`·.
[Microsoft MVP - Visual C++]
|
|
|
|
|
Make sure that WSAStartup() or AfxSocketInit() has been called successfully before you call any socket winsock functions.
cheers
Varghese Paul
|
|
|
|
|
Can anybody help me in finding the number of files in a particular folder.
I am using VS 6.0.
With regards
Deepu.
|
|
|
|
|
Do you need to CFileFind Class or FindFirstFile?
|
|
|
|
|
I am using CFileFind
Is that possible by using CFileFind::FindFile and CFile::FindNextFile.
If so can you tell me the procedure.
|
|
|
|
|
This exampl eis on the MSDN.
CFileFind finder;
BOOL bWorking = finder.FindFile(_T("*.*"));
while (bWorking)
{
bWorking = finder.FindNextFile();
TRACE(_T("%s\n"), (LPCTSTR)finder.GetFileName());
}
|
|
|
|
|
Hi Hamid and Machael
I came across a strange situvation
If i have to find the files in the "*.*" , it is working.But if i have to find in any other directories i have to append "\\*" to the end of the directory name and finally reduce the the count by 2;
CFileFind finder;
int NoOfFiles = 0;
BOOL bWorking =finder.FindFile( "D:\\Directory\\Subdirectory\\*") ;
while(bWorking)
{
bWorking = finder.FindNextFile();
NoOfFiles++;
}
NoOfFiles-=2;//Now it will give the actual number of files
}
why it so.I got the output but it is strange!!
|
|
|
|
|
Deepu Antony wrote: ...and finally reduce the the count by 2;
Most likely because you are counting the current and parent folders. Check out the CFileFind::IsDirectory() method.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
yes the first two values is directories.
But even if there are more than 2 directories
for eg e:\dir\subdir\subsubdir..
the first two values are showing only as directories.
still the count should be reduced by 2.
|
|
|
|
|
If you are only wanting to count files, then you must exclude those that are directories. If you are wanting to count everything except the current and parent directories, then you must exclude those directories whose name begins with a dot, like:
while (bWorking)
{
bWorking = finder.FindNextFile();
if (! finder.IsDots())
NoOfFiles++;
}
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Ah, but filenames can begin with a dot. It's best to check the attributes OR if the filename is nothing but dots.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Joe Woodbury wrote: Ah, but filenames can begin with a dot.
Of course, and I believe my comment accounted for that.
Joe Woodbury wrote: It's best to check the attributes...
Which is exactly what IsDirectory() and IsDots() does.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Sorry, misread your comment.
Anyone who thinks he has a better idea of what's good for people than people do is a swine.
- P.J. O'Rourke
|
|
|
|
|
Use FindFirstFile() and FindNextFile() to enumerate the files.
There are articles here on Code Project, there are also Google and MSDN. Search!
|
|
|
|