|
Replace setAge by Cat and remove the void
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Hi!
I have a problem and I cannot find the solution for it. I am using the win32 api to create a database application and I am sending sql statements to retrieve and put data.
In my access database I have a field called TEST, it is a text field. The thing I want to do is to add some text to it everytime the user opens my program. For that I am using:
<br />
_bstr_t sqlquery;<br />
LPTSTR tester = "";<br />
LPTSTR no = "12";<br />
char formula[MAX_PATH];<br />
sprintf(formula, "\"UPDATE TABLO SET TEST = '%s' WHERE (NO = '%s')\"", tester, no); <br />
sqlquery = (_bstr_t)formula;<br />
try<br />
{<br />
pSet = pDb->Execute(sqlquery, &vRecsAffected, adOptionUnspecified);<br />
}<br />
catch( _com_error &e )<br />
{<br />
bstr_t bstrSource(e.Source());<br />
_bstr_t bs = _bstr_t(" Error: ") + _bstr_t(e.Error()) + _bstr_t(" Mesaj: ") + _bstr_t(e.ErrorMessage()) + _bstr_t("\nHata Tanımı:\n") <br />
+ _bstr_t(e.Description()); <br />
MessageBox(0,bs,bstrSource, MB_OK);<br />
}<br />
<br />
And when my program runs it gives me an error like:
"Error: -2147217900 Message: IDispatch error #3092"
I am really confused Please help me!
Thank you very much for your future answers!
(Note the code up there works if there is less than 8 or 9 characters... )
Well... I am a beginner ...
|
|
|
|
|
What type of object is pDb ? At first I thought it was a CDatabase object, but that class has no Execute() method.
Have you tried Googling for the error?
http://www.google.com/search?hl=en&ie=UTF-8&oe=UTF-8&q=idispatch+3092&btnG=Google+Search
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
I googled it but I couldn't find any useful informations...
Well... I am a beginner ...
|
|
|
|
|
Don't put the update statement within quotes (in other words,
"UPDATE ...." instead of "\"UPDATE ...\"")
Also, I wouldn't use sprintf to build your query string. Too easy to get buffer overflow problems. Use STL strings or string streams or just concatenate _bstr_t's
|
|
|
|
|
Thank you very much for your answer!
Remowing the quotes solved my problem and now it is working fine...
Thanks a lot again...
Well... I am a beginner ...
|
|
|
|
|
I have a class cat and i am trying to pass an array of cat obiject to a function as well as valid components of the array.
void show(Cat cats[], int i)
What is incorrect in my line?
|
|
|
|
|
|
Could anyone tell me what is wrong with the following snippet? printf only prints the the first word of each key and printes it several times.
for example Microsoft Office would be printed as
Microsoft
Microsoft
microsoft and so an..
I am using XP sp1 and VS2003
Thanks,
Max....
long RESULT;
HKEY hKey;
int _tmain(int argc, _TCHAR* argv[])
{
RESULT = RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall", 0, KEY_READ, &hKey);
printf("Regopen returned %d ", RESULT );
int KeyIndex = NULL;
CHAR SubKeyName[MAX_PATH];
DWORD SubKeyLenth = [MAX_PATH];
FILETIME InstallDate;
do
{
RESULT = RegEnumKeyEx(hKey,
KeyIndex,
SubKeyName,
&SubKeyLenth,
NULL,
NULL,
NULL,
&InstallDate);
printf( "(%d) %s\n", KeyIndex++ , SubKeyName);
}
while (RESULT != ERROR_NO_MORE_ITEMS);
return 0;
}
|
|
|
|
|
do
{
SubKeyLenth = MAX_PATH;
RESULT = RegEnumKeyEx(hKey, KeyIndex,SubKeyName,&SubKeyLenth,
NULL,NULL,NULL,&InstallDate);
printf( "(%d) %s\n", KeyIndex++ , SubKeyName);
}
SubKeyLenth <- is in/out and it needs to be reset on every iteration
|
|
|
|
|
Hi,
i am writing a program which produces a constant square wave form from Parallel port. I am doing this in a infinite while loop, the problem is i also want something to happen when i click a button on the dialog. How do i keep the loop runing and still be able to click a button?
THANKS
|
|
|
|
|
Check Subject below "App still works but GUI does not update when moved."
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Papa wrote:
while (TRUE)
Papa.WillLove ( Bebe ) ;
Not many events in your loop!;P
|
|
|
|
|
WillLove is a sum of events
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Yes you should put your loop in a thread but if youu want something quick and dirty, call the following function (DoEvents) in your loop.
<br />
BOOL DoEvents()<br />
{<br />
MSG msg;<br />
while (::PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))<br />
{<br />
if (msg.message == WM_QUIT)<br />
{<br />
return FALSE;<br />
}<br />
if (!AfxGetApp()->PreTranslateMessage(&msg))<br />
{<br />
::TranslateMessage(&msg);<br />
::DispatchMessage(&msg);<br />
}<br />
}<br />
return TRUE;<br />
}<br />
|
|
|
|
|
Hi,
1. is manipulating font size, the only way to resize non-owner-drawn conbo box?
2. using SetFont() and resizing combo box, i get the combo box show right but calling GetWindowRect() with list box not dropped, returns some default size, no matter what the actual visible size is. how can i get the correcty visible size?
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
Email: y_becker@netvision.net.il
|
|
|
|
|
GetWindowRect should return the size of the combobox + the size of the drop window. When you use MoveWindow(0 on a combo box, the rect you provide includes the drop window size. When the drop window is not whown, I beleive that the combo box sizes to the size of GetSystemMetrics(SM_CYVSCROLL), but if your using a different font, it may not be correct.
Roger Allen
Sonork 100.10016
Death come early, death come late,
It takes us all, there is no reason.
For every purpose under heaven,
To each a turn, to each a season.
A time to weep and a time to sigh,
A time to laugh and a time to cry,
A time to be born and a time to die.
Dust to dust and ashes to ashes,
And so I end my song.
|
|
|
|
|
Thank you Roger,
the returned combo height is indeed constant (SM_CYVSCROLL = 20 on my system) and equals 24.
BUT
how can i get the visible size of the non-list-dropped combo ? is this a system constant as well !?
Roger Allen wrote:
GetWindowRect should return the size of the combobox + the size of the drop window. When you use MoveWindow(0 on a combo box, the rect you provide includes the drop window size. When the drop window is not whown, I beleive that the combo box sizes to the size of GetSystemMetrics(SM_CYVSCROLL), but if your using a different font, it may not be correct.
Roger Allen
Sonork 100.10016
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
Email: y_becker@netvision.net.il
|
|
|
|
|
Yonatan wrote:
how can i get the visible size of the non-list-dropped combo ? is this a system constant as well !?
Its something that I have looked for myself. I do not know of a specific constant for it. I have usually simulated it in the past by having another control the same height as a combobox on the form and measuring that.
The other thng you could do is add in some borders:
GetSystemMetrics(SM_CYBORDER) * 2 + GetSystemMetrics(SM_CYVSCROLL);
Roger Allen
Sonork 100.10016
Death come early, death come late,
It takes us all, there is no reason.
For every purpose under heaven,
To each a turn, to each a season.
A time to weep and a time to sigh,
A time to laugh and a time to cry,
A time to be born and a time to die.
Dust to dust and ashes to ashes,
And so I end my song.
|
|
|
|
|
Dear Roger, Dave, thank you again for your answers.
since English is not my mother tongue (hint: i fluently read the original scripture of Ecclesiastes, the resource of the poem Roger quotes ), the question i posed may have been somewhat unclear.
i want to embed a combobox inside a list control subitem. now, by changing the combo font size i can control the combo (==edit+arrow == -1 item) size (SetItemHeight(-1, x) fails here), and visibly make it smaller than system default (without resorting to Owner-Drawn combo). alas, i wish to programatically quantify the combo frame VISIBLE size, to some actual pixel measure (i do not wish to use the resource editor). i cannot get it with GetClient\WindowRect() because of unknown reasons (which have nothing to do with drop down list size).
i hope i could profit from your experience.
Thank you all , yonatan
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
Email: y_becker@netvision.net.il
|
|
|
|
|
Use CComboBox::GetItemHeight() /CComboBox::SetItemHeight() with nIndex set to -1 to get/set the height of the edit/static control portion of the combobox
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Dear PJ, thank you for your answer.
Please check my last answer to Roger.
please advise, , yonatan
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
Email: y_becker@netvision.net.il
|
|
|
|
|
I have a problem with a FormView. How do you implement copy and paste.
How to activeate cut and paste in the controls on the form.
Please help
Jørgen Granborg
|
|
|
|
|
Add your own handlers for cut/copy/paste
ON_COMMAND(ID_EDIT_COPY, OnEditCopy)
void CXView::OnEditCopy()
{
CWnd* pWnd = GetFocus();
if ( pWnd != NULL )
pWnd -> SendMessage(WM_COPY);
}
|
|
|
|
|
Hello,
I am studying an doing applications with C#. I don´t know how transform an EJB to C#. Which are the equivalent files in C# to the files in Java where you define Local and Home Interface? Only with the .cs file and including using in the file where you want to use this classes you are programming with .Net Architecture or is necessary define interfaces in any place in Visual Studio.Net.
Thanks for your help
LUIS
|
|
|
|