|
Hi,
The GetLastError() function of yr's says "Handle invalid"(6) and "Module can't be found"(126).So, I hope problem with the Dll path u have given.First find out in which path yr Dll is present and give that path in the LoadLibrary()/GetModuleHandle() function.Then check for the handle.This could be the only problem I hope.Let me know if it works.
Regards,
yamini.
|
|
|
|
|
Thanks for your quick answer
But...
That is not the problem.
I could this function like this:
1: 'LoadLibrary("c:\\MyDLL2.DLL")'
or
2: 'LoadLibrary(_T("c:\\MyDLL2.DLL"))'
or
3: 'LoadLibrary((LPCTSTR)"c:\\MyDLL2.DLL")'
*) I added 'C:\MyDLL2.lib' in Project->Settings...
*) I added 'C:\' to the system path
*) I added 'C:\' to the project path (in Project->Settings)
I don't know what to do
Name: STR
|
|
|
|
|
Launch depends.exe - Dependency Walker which is a part of MsVisual C++. Drag and drop this Your dll onto depends.exe window. See what it will say.
Probably some dll which is required by Your dll cannot be found. For example the dll You are loading needs msvcrt.dll(insert any), which is not on the path.
Hope, this helps
|
|
|
|
|
Hi,
I use CreateFile, ReadFile, WriteFile, COMMSTAT, CLEARCOMMERROR for using the SerialPort in RS422.
I would like some help for settings the DCB.
I use my little program for communicate with a device.
In my settings , I would like :
- 38400 Bauds,
- 8 Bits,
- 1 Stop Bit,
- EVEN Parity,
- Binary Mode,
- Set RTS and DTR Enable,
- HandShaking comRTS.
If anyone can check my code for correct it because it doesn't working with my interface in RS422. But if I use this with hyperterminal in RS232 NullModem cable all are ok.
Best regards
// Open SerialPort (nComport = the port number )
//----------------------------------------------
//
// HANDLE hPort;
DWORD dwError; // dwThreadID;
DCB PortDCB;
COMMTIMEOUTS CommTimeouts;
CString strComPort;
strComPort.Format("COM%d", nComport);
// Open the serial port.
BETACART_hPort = CreateFile (strComPort, // Pointer to the name of the port
GENERIC_READ | GENERIC_WRITE,
// Access (read/write) mode
0, // Share mode
NULL, // Pointer to the security attribute
OPEN_EXISTING, // How to open the serial port
0, // Port attributes
NULL); // Handle to port with attribute
// to copy
// If it fails to open the port, return FALSE.
if ( BETACART_hPort == INVALID_HANDLE_VALUE )
{
// Could not open the port.
MessageBox (TEXT("Le Port RS sélectionné n'existe pas"),
TEXT("Error"), MB_OK);
dwError = GetLastError ();
}
PortDCB.DCBlength = sizeof (DCB);
// Get the default port setting information.
GetCommState (BETACART_hPort, &PortDCB);
// Change the DCB structure settings.
PortDCB.BaudRate = 38400; // Current baud
PortDCB.fBinary = TRUE; // Binary mode; no EOF check
PortDCB.fParity = TRUE; // Enable parity checking.
PortDCB.fOutxCtsFlow = FALSE; // No CTS output flow control
PortDCB.fOutxDsrFlow = FALSE; // No DSR output flow control
PortDCB.fDtrControl = DTR_CONTROL_DISABLE; //DTR_CONTROL_HANDSHAKE; //DTR_CONTROL_ENABLE;
// DTR flow control type
PortDCB.fDsrSensitivity = FALSE; // DSR sensitivity
PortDCB.fTXContinueOnXoff = TRUE; // XOFF continues Tx
PortDCB.fOutX = FALSE; // No XON/XOFF out flow control
PortDCB.fInX = FALSE; // No XON/XOFF in flow control
PortDCB.fErrorChar = FALSE; // Disable error replacement.
PortDCB.fNull = FALSE; // Disable null stripping.
PortDCB.fRtsControl = RTS_CONTROL_HANDSHAKE; //RTS_CONTROL_ENABLE;
// RTS flow control
PortDCB.fAbortOnError = FALSE; // Do not abort reads/writes on
// error.
PortDCB.ByteSize = 8; // Number of bits/bytes, 4-8
PortDCB.Parity = EVENPARITY; //ODDPARITY; // 0-4=no,odd,even,mark,space
PortDCB.StopBits = ONESTOPBIT; // 0,1,2 = 1, 1.5, 2
// Configure the port according to the specifications of the DCB
// structure.
if (!SetCommState (BETACART_hPort, &PortDCB))
{
// Could not configure the serial port.
MessageBox (TEXT("Unable to configure the serial port"),
TEXT("Error"), MB_OK);
//dwError = GetLastError ();
}
// Direct the port to perform extended functions SETDTR and SETRTS.
// SETDTR: Sends the DTR (data-terminal-ready) signal.
// SETRTS: Sends the RTS (request-to-send) signal.
EscapeCommFunction (BETACART_hPort, SETDTR);
EscapeCommFunction (BETACART_hPort, SETRTS);
youssef
|
|
|
|
|
Hi Youssef
I'm not a guru here, but after a quick look at the specs I'd say that RS422 and RS232 are almost but not quite compatible. RS232 uses a 3 wire interface, while RS422 uses a 4 wire connection, refered to as 'balanced' - I think you will not be able to go directly from your PC to the RS422 device.
But, there are converters available to go between RS232 and RS422 devices - probably available for something like 50USD. Search for RS422 on Google, you'll find a bunch!
HTH
T
later...
Of course, if you already have one of these converters, then I'm being presumptious, and will shut up and go away...
BTW what kind of device is it?
|
|
|
|
|
hi,
in the Internet Options' connection tab, there is
a group of radio buttons with following value:
1) never dial a connection
2) dial whenever a connection is not present
3) always dial my default connection.
where the value is stored? and can we set this in the code?
thanks.
|
|
|
|
|
Hi
I have some question about DAO :
1 - When I use MFC wizard there is three choice
(Snapshot , Dynaset , Table),so what difference ...
2 - If my access file has two tables I have two problems :
A- How I can determine which table I want to add record ...
B- When I use code like this
m_pSet->AddNew();
m_pSet->m_id=1; //table 1
m_pSet->m_name="Ahmad"; //table 1
m_pSet->m_id2=1; //table 2
m_pSet->m_phone=21598356; //table 2
m_pSet->Update();
a meesage box appeare and tell me that :
Can't update. Database or object is read only
3- How I can use SQL statements with VC++ 6 ...
Thank you
AHMAD ALWASHALI
|
|
|
|
|
Here's some short replies. I really recommend that you read some books on the subject, as it is a huge one. "Microsoft Jet Database Engine Programmers Guide" used to be online on MSDN, but I can't find it there anymore. It's a bit outdated anyway, but gives you a good grip on DAO (although it's written for VB!!!). If you have some MSDN Library CD's from last year I guess it will be there.
The answers:
1: snapshot: the resultset is a snapshot of the data in the database. Changes to the data in the db after the snapshot is opened is not reflected in the snapshot. The snapshot is read-only (and I vaguely remember something about it being forward-only also).
Dynaset: the resultset represents the actual data in the database at the time you fetch (i.e. read) the data. Updateable.
Snapshots and Dynasets are the result of a query, i.e. an SQL statement.
Table: as Dynaset, but gives you all the fields of one particular table. Among other things very useful if you want to browse the table, or as a basis for a data-entry form in your program.
2: You probably asked for a snapshot - they're read-only.
3: Use a QueryDef object. Here you can set the SQL text.
good luck
Steen
|
|
|
|
|
Thank you very much,your answer was very useful ...
AHMAD ALWASHALI
|
|
|
|
|
Hi
- Microsoft Communication Control which it
as Active X control ,,,
I think it's for dialing by FaxModm,so any one can tell
me how I can use it ,,,
I hope if you can tell me about any web site can give
me a simple about that...
- And if I used TAPI function ,
is it must the DIALER(MICROSOFT) programe run to
do the function like Address Book project
which you can find it in codeproject(Home >> Samples >> General )???
And I hope if you can tell me about any web site can give
me a simple and explain about TAPI...
Thank you
AHMAD ALWASHALI
|
|
|
|
|
How do I get a reference to the document from MainFrame?
|
|
|
|
|
Hi all,
I'm having great problems sending email from an NT service- the only place I've found it mentioned was in MSDN referring to Extended MAPI
Given that I don't want to go to such great lengths to do it, can anyone let me know of a way to send email from a service? All I need to do is send a simple message to a recipient. Thanks very much for any help.
Cheers
NB
|
|
|
|
|
I've tried using CDO's IMessage (in a very simple manner), but for some reason it calls int 3 ... ? ... and just generally dies with a message about an invalid heap pointer deep in the cdo code.
|
|
|
|
|
You can try using SMTP.
Here are some Classes designed to get around problems associated with services : http://www.codeproject.com/internet/csmtpconn.asp
I think there is a newer version at the authors site. They are really easy to use, and work well.
Giles
|
|
|
|
|
thanks, giles, i'll have a look at them
|
|
|
|
|
BTW, there are some classes available through PJ Naughter's site that port Naughter's code from MFC to STL, which saved me a great hassle.
As you said, very easy to use, did the trick fantastically.
|
|
|
|
|
Which ones? That could be very useful.
Thanks,
Giles
|
|
|
|
|
all of the classes from 1.21, I believe, also compiled into a dll that exports a 'quick & easy' PJSendMail() function (perfect for what I needed to do!)
you can download the code at http://naughter.com/download/pj_smtp_stl.zip
|
|
|
|
|
Hello All
I'm attempting to build an SDI application with a splitter window. In the right window, I want to add a propertysheet that contains several propertypages.
I am able to do this just fine in dialog box; however, I can't figure out how to add a propersheet/page directly to the right hand window of an SDI application.
Your help is appreciated.
sam
|
|
|
|
|
Hello everybody,
I am doing an application using C++ that will detect any changes in a directory. Details of any file changes will be notified using the ReadDirectoryChangesW.
Microsoft have a sample code that uses this function which is the fwatch program in the MSDN samples
I tried to reuse some of the codes from fwatch to my current application but it doesn't work. A lot of errors stating comming out from winbase.h and winnt.h file. An error saying that the ReadDirectoryChangesW is not defined also included.
I am now suspecting there is has something to do with the makefile file. Can somebody please explain how and why makefile is created and why there are so many errors in the header files?
Any solution is appreciated
thanks
|
|
|
|
|
|
Hello,
I am having problems with this code working on a windows 98 machine.. I have tested it tons of 95, NT and 2000 machines and I have yet to see any problems... but I have one 98 machine that is unable to create the text file.. here is a sample of my code.. can anyone tell me what I might change to get this to work on the 98 machine...
The code goes out to a Internet url and pulls just the htmls' source and dumps it to a text file so I can open it and parse it later etc...
//Operation that goes to the url and pulls the source
CString CUserProfileDlg::GetFile(const char *url, const Char *filename)
{
char httpbuff[HTTPBUFLEN];
TCHAR szCause[2048];
CString Cause;
Cause.Format("YES");
TRY
{
CInternetSession mysession;
CStdioFile *remotefile = mysession.OpenURL(url,1,INTERNET_FLAG_TRANSFER_BINARY|INTERNET_FLAG_RELOAD);
CFile myfile(filename, CFile::modeCreate|CFile::modeWrite|CFile::typeBinary);
int numbytes;
while (numbytes = remotefile->Read(httpbuff, HTTPBUFLEN))
{
myfile.Write(httpbuff, numbytes);
}
}
CATCH_ALL(error)
{
error->GetErrorMessage(szCause,2046,NULL);
Cause.Format("%s",szCause);
}
END_CATCH_ALL;
return (Cause);
}
//Operation of creating the text file
GetFile(strU+strB+strQ, _T("Source.txt")); //grabing html source
//Open the txt file and read it into a member variable
CFile fileEditText;
if(fileEditText.Open(_T("Source.txt"),CFile::modeRead))
{
//Declare a large buffer for reading the text
char cBuf[1024];
UINT uBytesRead;
//Continue reading until no more data is read
while(uBytesRead =
fileEditText.Read(cBuf, sizeof(cBuf)-1))
{
//Null terminate after the last charcter
cBuf[uBytesRead] = NULL;
//add the buffer to the mapped CString
strTime += CString(cBuf);
}
//Close the file
fileEditText.Close();
//Send the string to the variable
UpdateData(FALSE);
}
After that the file should be created.. I then open it and read it into a variable then parse it for values etc....
Any ideas why this doesn't work just on the 98 machine?
Thanks,
Rob Jones
|
|
|
|
|
Could someone tell me, how do I easily test for previous instances within MFC (for example when I only want to run one instance of my application).
It appears that the CWinApp::m_hPrevInstance variable is always set to NULL so I cannot use that. The MSDN help suggests that I use CWnd::FindWindow() but I can't seem to get that working.
Kind Regards,
Peter Eisfelder
Peter Eisfelder
|
|
|
|
|
http://www.naughter.com/sinstance.html
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I want to create a new process, but I don't want to do anything with it. Just fire up an executable and send it on it's way. This is the code I'm using. I'm not leaking memory in any way, right? This is an acceptable way to do it, right? I just want to be sure... Thanks in advance
HANDLE hProcess = NULL;
SHELLEXECUTEINFO shellInfo;
::ZeroMemory(&shellInfo, sizeof(shellInfo));
shellInfo.cbSize = sizeof(shellInfo);
shellInfo.fMask = SEE_MASK_NOCLOSEPROCESS;
shellInfo.lpFile = "executable.exe";
shellInfo.lpParameters = ".\\readme.txt";
if(::ShellExecuteEx(&shellInfo))
{
hProcess = shellInfo.hProcess;
::CloseHandle (hProcess);
}
--
Peace,
Amit Jain
|
|
|
|
|