|
If you are using Win95 or Win98 then you may be able to do it using assembler. If you are using NT/2K or XP then things get more tricky.
Basically, you need a driver to allow direct access to the parallel port (which is not normally allowed).
I used one ages ago, which you could give a range of I/O addresses, and you could read or write to them via a DLL. I can't remember what it is called, but
Try googling for "parallel port access windows driver".
|
|
|
|
|
I've sucseffuly used a general purpose device drive called "TinyPort". It's good, but it warns you that it is relativly slow, being that it is general purpose, not specific to a device.
|
|
|
|
|
|
For interfacing with parallel or serial ports in VC6, you need to get a handle by calling CreateFile function. Pass "LPT1:" as filename.
Arsalan Malik
|
|
|
|
|
Hi Everybody,
I have a small problem with MDI application. Actally I want to customize MDI application in such a way that if some one open menu->File->Open we will get file open dialog box. I want to customize this file open dialog box so that it obeys only .BMP extension file. Please note that I don't want to write my CFileDialog object and handle menu. I just want to customize the default file dialog so that it only obeys .BMP file extension.
Thanks in Advance
Salman
Live and Let live
|
|
|
|
|
Hi,
You can define the CFileDialog object as following.
CFileDialog FileDialog(FALSE, NULL, NULL,OFN_HIDEREADONLY , "Rule Files (*.rule)|*.rule||");
|
|
|
|
|
Hi ..
I want to convert my "CString" to "LPCWSTR" type.. How can I do this???
Plz help me out ..
Thanks
Sudhakar
|
|
|
|
|
Use the function mbstowcs. It takes a char pointer, so use GetBuffer function of CString to get char pointer. Alternatively you can use AllocSysString method to BSTR, which can be easily passed as LPCWSTR.
Arsalan Malik
|
|
|
|
|
use the member function GetBuffer()
Link to microsoft documentation of CString::GetBuffer
example:
CString MyString("This is my string");
LPCWSTR MyLPCWSTR = (LPCWSTR) MyString.GetBuffer(MyString.GetLength());
note: the return type of GetBuffer() is LPTSTR
|
|
|
|
|
Thanks for the info..
It was working perfectly..
Thanks
Sudhakar
|
|
|
|
|
Remember that for every call to GetBuffer() , there must also be a call to ReleaseBuffer() . If you are not going to be editing the internal CString buffer, why ask for a writeable copy? Try this instead:
CString MyString("This is my string");
LPCWSTR MyLPCWSTR = (LPCWSTR) ((LPCTSTR) MyString);
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I know there is a small function that checks if a file exists but I can’t find it.
_____________________________
...and justice for all
APe
|
|
|
|
|
hi ,
try this out
CFileFind oFileFind;
if ( oFileFind.FindFile("C:\\myFile.txt") == 0 )
MessageBox("File Not Found")
by
baijumax;P
|
|
|
|
|
You're the hero of the day
_____________________________
...and justice for all
APe
|
|
|
|
|
hi apeman,
thanks 4 u r comment.why don't u wish me,
hero of future computing.
by
baijumax;)
|
|
|
|
|
You can use FindFirstFile and FindNextFile functions in API.
Arsalan Malik
|
|
|
|
|
Check _access and _waccess
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
You can use this function : PathFileExists(“C:\\myFile.txt”)
hanhquang
|
|
|
|
|
Hi All,
I'm trying to make a debug function, which will be fairly multiple use in my app, dependant on Command line arguments.
The functon will always TRACE(), and if optionally specified, will write debug info to STDERR, or to a log file. All in one.
I'd like to be able to implement a variable argument list function to do this.
However, I can't find a way to pass the argument list to another variable argument list function.
I'd like to have something like this:-
void MyDebug(char * psFormat, ...)
{
va_list al;
va_start(al, psFormat);
and then format a string based on the variable arg list, something like this (which does not work).
char szDbgMessage[4096];
sscanf(szDbgMessage,pszFormat, al);
because, after that, I could do whatever I wanted with the string... TRACE0() it, cout it, chuck it out to a file, or even make a cup of tea with it?
I managed to do more or less exactly this with gcc with the Gameboy as a target, but no compiler implementor does this the same. Has anyone ever managed this in VC++.
Thanks
JOn
TRACE0(szDbgMessage);
va_end(ptr);
using System.Beer;
|
|
|
|
|
Hello,
this code does works :
void _cdecl OutputDebug(LPCSTR Fmt, ...)
{
char buff[MY_SIZE_BUFF] ;
va_list args ; va_start(args,Fmt) ;
wvsprintf(buff,Fmt,args) ;
va_end(args) ;
OutputDebugString(buff) ; // Or anything you want ...
}
there are some string function accepting va_list as argument. They have 'v' in there name : vprintf(), vsprintf(), CString::FormatV()
don't forget the _cdecl on functions with variable arguments list (, ...)
|
|
|
|
|
Just what I was looking for! Thankyou!
using System.Beer;
|
|
|
|
|
Hi everyone!
Got a quick, yet stupid question!
Why cant you init anything inside a class unless its static const int ?
Actualy the question is how can you initialize an array inside class private:
to be const .
I know that it is possible to declare an array and then use a constructor to init it. But how do I make it const if I was to do it thru the constructor.
Thanks.
|
|
|
|
|
You can declare an array inside private block, e.g.
class A {
private:
static const int array[10];
};
and initialize outside class as:
const A::array[10] = {0};
As far as I know, you cannot initialize an const array using constructor list.
Arsalan Malik
|
|
|
|
|
Although the former is valid C++ syntax, I think the VC6 compiler will have issues with it.
|
|
|
|
|
I have successfully compiled this syntax with VC6, and found no issues.
Arsalan Malik
|
|
|
|