|
Hello,
I have a little Win32 Windows app in C. It accepts filename as argument and calculates MD5 hash for the file. The dialog based app should show up with MD5 calculated. When I put hashing function to be executed under WM_INITDIALOG it fails and MD5 hash is not calculated. When should I execute it? I have tried WM_PAINT but md5 hashing gets executed all time then. Please help when should I begin hashing in this app.
I have VB6 background I remember I used to place all start up code under Form - OnLoad function. But in Win32 it is getting so hard. Please help a newbie.
|
|
|
|
|
You can still do the processing in response to WM_INITDIALOG , but only indirectly. Consider something like:
LRESULT CALLBACK DialogProc( HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
switch (uMsg)
{
case WM_INITDIALOG:
PostMessage(hDlg, user_defined_message);
break;
case user_defined_message:
break;
default:
return FALSE;
}
return TRUE;
}
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Thank you and others who took time to respond. Its working now 
|
|
|
|
|
|
Ugh... The dude is using things like WM_USER+1 to define a "unique message" and such 'technique' is bound to break some day. I'd use RegisterWindowMessage [^] instead...
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
No, very bad.
Read Petzod and Richter for Win32 basics about messages
|
|
|
|
|
I am running a VC++ application, got a fatal error, clicked on the debug button, and the debugger open to this page which I have some problem understanding. Will like to get some help on how to interpret this error message.
Thanks much.
RDLLocation *GetDemandLocation()
{
return pDemandLocation; //this is where the deburgger yellow arrow is pointing
}
- this 0xdddddddd
- RDLLoObject {...}
- RDLDatabaseObject {...}
- TStreamableBase {...}
__vfptr CXX0030: Error: expression cannot be evaluated
loadStatus CXX0030: Error: expression cannot be evaluated
- Name {???}
m_pchData CXX0030: Error: expression cannot be evaluated
- _destructCB {...}
__vfptr CXX0030: Error: expression cannot be evaluated
_enabled CXX0030: Error: expression cannot be evaluated
_needToInvoke CXX0030: Error: expression cannot be evaluated
_doorOpen CXX0030: Error: expression cannot be evaluated
_srcObj CXX0030: Error: expression cannot be evaluated
- _cbList {...}
allocator {...}
_Head CXX0030: Error: expression cannot be evaluated
_Size CXX0030: Error: expression cannot be evaluated
- _valueCB {...}
__vfptr CXX0030: Error: expression cannot be evaluated
_enabled CXX0030: Error: expression cannot be evaluated
_needToInvoke CXX0030: Error: expression cannot be evaluated
_doorOpen CXX0030: Error: expression cannot be evaluated
_srcObj CXX0030: Error: expression cannot be evaluated
- _cbList {...}
allocator {...}
_Head CXX0017: Error: symbol "" not found
_Size CXX0030: Error: expression cannot be evaluated
ulDisplayFlags CXX0030: Error: expression cannot be evaluated
pLoadItemSet CXX0017: Error: symbol "CSet<RDLLoadItem,1>" not found
pDemandLocation CXX0030: Error: expression cannot be evaluated
pSupplyLocation CXX0030: Error: expression cannot be evaluated
pProTransResSet CXX0017: Error: symbol "CSet<RDLString,1>" not found
pTimeWindowSet CXX0017: Error: symbol "CSet<RDLShipmentTimeWindow,1>" not found
- LoadRef {???}
m_pchData CXX0030: Error: expression cannot be evaluated
ShipmentDemandType CXX0030: Error: expression cannot be evaluated
Demand1 CXX0030: Error: expression cannot be evaluated
Demand2 CXX0030: Error: expression cannot be evaluated
Demand3 CXX0030: Error: expression cannot be evaluated
LoadRate1 CXX0030: Error: expression cannot be evaluated
LoadRate2 CXX0030: Error: expression cannot be evaluated
LoadRate3 CXX0030: Error: expression cannot be evaluated
UnLoadRate1 CXX0030: Error: expression cannot be evaluated
UnLoadRate2 CXX0030: Error: expression cannot be evaluated
UnLoadRate3 CXX0030: Error: expression cannot be evaluated
CommonCarrierCost CXX0030: Error: expression cannot be evaluated
ShipmentPriority CXX0030: Error: expression cannot be evaluated
FixedServiceTime CXX0030: Error: expression cannot be evaluated
IsDummy CXX0030: Error: expression cannot be evaluated
CurrentLoadItemNumber CXX0030: Error: expression cannot be evaluated
validDays CXX0030: Error: expression cannot be evaluated
pTmpTimeWindowSet CXX0017: Error: symbol "CSet<RDLShipmentTimeWindow,1>" not found
fLTLCost CXX0030: Error: expression cannot be evaluated
|
|
|
|
|
"pDemandLocation" was not initialized or assigned a value.
|
|
|
|
|
hello sir/madam,
I am an novice programmer and eager to learn as fast as it is possible to learn so i decided to move to solve the programming puzzles but i don't know i step up for this. Which book I prefer to start as a programmer to solve programming puzzles.
Pls enlist some good books or any other resource from where I learn some related to solving programming puzzles.
Thanx in advance.
|
|
|
|
|
|
Hi,
choose first which kind of programming language you want to learn. Then learn the things, suppose if you want to learn any Microsoft technology it can be improved by WWW.msdn.com. Like this for every language we have to choose correct path.
And when have discussion with people like code project obviously we will get different problems and we improve the things very firstly.
For problem solving relate issues go through WWW.topcoder.com
sampath-padamatinti
|
|
|
|
|
Can anyone please suggest how to work on Database i.e MS-Access in VC++ MFC Dialog Based application.I know we can use other options in MFC such as single document/multi document option and gain database support.But when we use Dialog Based option in MFC,We have to manually select the Base class as CRecordView instead of CDialog,I know that,but how to proceed after that?So to set up database connectivity in Dialog based option of MFC.Please let me know how to go about this or please tell me the articles which provide this information.I really need this.
|
|
|
|
|
Start with the CDatabase[^] and CRecordset[^] classes.
«_Superman_»
I love work. It gives me something to do between weekends.
Microsoft MVP (Visual C++)
|
|
|
|
|
For DAO (MS-Access) classes, you should add following line to "stdafx.h" file.
<br />
#include <afxdao.h>
Then, you might use CDaoDatabase/CDaoRecordset classes like below.
CDaoDatabase db;
db.Open(pszFileName, FALSE, FALSE, pszConnect);
CDaoRecordset rs(&db);
rs.Open(dbOpenSnapshot, pszSQL, dbReadOnly | dbForwardOnly);
rs.Close();
db.Close();
Because you can not benefit from Doc/View support in a dialog, you can not use CRecordView (or CDaoRecordView for DAO) class within this type of project. If you need a "form like behavior" in a dialog, you need to implement yourself (or find an already implemented one, if any) by setting a connection between recordset and dialog (or its controls) with or without a document class.
|
|
|
|
|
Hi,
I am not able to Insert a record in Acess Table. I am Using ODBC API.
::SqlExecute(...) it is failing to Insert Records.
Please help me out.
Also if i want to move a record to a particular position how can i acieve this. Ex Rs.Move(...) Wrapper in low level ODBC API Call.
Thanks in advance,
Uday.
|
|
|
|
|
janaswamy uday wrote: ::SqlExecute(...) it is failing to Insert Records.
Why?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
UpdateData(TRUE);
SQLHENV envHandle;
SQLHDBC ConnHandle;
SQLHSTMT StmtHandle;
SQLRETURN Ret;
SQLSMALLINT szConnStroutlen;
unsigned char szConnStrout[255];
Ret = ::SQLAllocEnv(&envHandle);
if(Ret != SQL_SUCCESS)
{
AfxMessageBox("Alloc Handle is Faile",MB_OK);
}
Ret = ::SQLAllocConnect(envHandle,&ConnHandle);
if(Ret != SQL_SUCCESS)
{
AfxMessageBox("Alloc Connect is Faile",MB_OK);
}
//Connect through the Data Base in Acess
Ret = ::SQLDriverConnect(ConnHandle,
NULL,(unsigned char *)"Driver={Microsoft Access Driver (*.mdb)}; DBQ=C:\\Uday.mdb",
SQL_NTS,szConnStrout,sizeof(szConnStrout),&szConnStroutlen,SQL_DRIVER_NOPROMPT);
if(Ret != SQL_SUCCESS)
{
AfxMessageBox("SQLDriverConnect is Faile",MB_OK);
}
Ret = ::SQLAllocStmt(ConnHandle,&StmtHandle);
if(Ret != SQL_SUCCESS)
{
AfxMessageBox("SQLAllocStmt is Faile",MB_OK);
}
CString szResultant;
szResultant.Empty();
szResultant = "INSERT INTO Emp(Name,Address)VALUES (";
szResultant += "'";
szResultant += EmpName;
szResultant += "'";
szResultant += ",";
szResultant += "'";
szResultant += EmpAddress;
szResultant += "'";
szResultant += ")";
//--------> Here it is Failing. But if i hard code the Insert Statement is working Finde. But Appending to String Failed.
Ret = ::SQLExecDirect(StmtHandle,(SQLCHAR*)"INSERT INTO Emp(Name,Address)VALUES ('vijay','Saifabad')",SQL_NTS);
if(Ret != SQL_SUCCESS)
{
AfxMessageBox("SQLExecDirect is Faile",MB_OK);
}
|
|
|
|
|
I asked "Why?" not "Show me a bunch of code."
janaswamy uday wrote: CString szResultant;
szResultant.Empty();
szResultant = "INSERT INTO Emp(Name,Address)VALUES (";
szResultant += "'";
szResultant += EmpName;
szResultant += "'";
szResultant += ",";
szResultant += "'";
szResultant += EmpAddress;
szResultant += "'";
szResultant += ")";
Why not use:
szResultant.Format("INSERT INTO Emp(Name,Address) VALUES('%s','%s')", EmpName, EmpAddress); janaswamy uday wrote: //--------> Here it is Failing.
With what value?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
The Value is -1. Not able to Parse the Query String
|
|
|
|
|
janaswamy uday wrote: Not able to Parse the Query String
That came back from SQLGetDiagRec() ?
Have you compared szResultant with the string literal to see if there are any differences?
What happens if you use CString::Format() instead?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Most likely the SQL statement is not right.
Try manually with your SQL string generated by your program and see it can insert records or not.
modified on Monday, October 12, 2009 5:25 PM
|
|
|
|
|
After reading your subsequent posts, it seems to be a string type problem. That is, ANSI/UNICODE mismatch.
Try the following;
USES_CONVERSION;
Ret = ::SQLExecDirect(StmtHandle,(SQLCHAR*)T2A((LPTSTR)(LPCTSTR)szResultant),SQL_NTS);
if(Ret != SQL_SUCCESS)
{
...
}
...
|
|
|
|
|
Dear Ozer Karaaagar,
I got it and very much thankfull to you. Let Me know one more API where it will move the Record to Specific Position. Let me know the solution to Move a Record to MoveFirst,MoveNext,MovePrevious and MoveLast. Which API must be used.
If i Have to Use ::SQLSetPos(...) API. Please give me the Steps to move to Absolute Position. Please give me the solution. It is Urgent.
Thanks & Regards,
Uday.
|
|
|
|
|
I've seen AfxMessageBox() and UpdateData() functions in your code snippet, it's a MFC project as far as I understand.
So, Why won't you use CRecordset class of MFC? It provides ODBC data access and it has got all you need (Move*() functions and a limited SetAbsolutePosition()). This will simplify your job pretty much.
Anyway, for question about Move functions;
::SQLExtendedFetch() can be used with 2nd argument should be one of the SQL_FETCH_* constants (i.e. SQL_FETCH_NEXT, SQL_FETCH_PRIOR etc.)
However, you shouldn't expect to get accurate (absolute) sequential positioning in multiuser, dynamic SQL database environments. Bookmarks can also be used for that purpose.
|
|
|
|
|
Thank u very much for ur good and valuble solution.
i am very much thank full to you.
uday.
|
|
|
|