|
when i programaticaly press button by
SetState(TRUE)
and user leaves it using tab-key
button executes command (the same action like button press by user)
-> how to avoid this call? (i need this command when user clicks on button only (or uses keyboard to press it))
thanks for reply
t!
|
|
|
|
|
Hello,
I'm writing a C# application using managed and unmanged c++ libraries.
I have a bug, which causes an assertion "_BLOCK_TYPE_IS_VALID".
The message appears always in a different places.
Exceptions handling is not helping. Where to look?
|
|
|
|
|
Hi,
I am trying to get the connection status of my ODBC connection to MySQL in a VC++.Net project, by retrieving the "SQL_ATTR_CONNECTION_DEAD" attribute using the SQLGetConnectAttr function.
But whether the MySQL server is running or not its always returning 0 which implies SQL_CD_FALSE (i,e. the connection is still active.)
I made the connection as folows:-
SQLAllocHandle(SQL_HANDLE_ENV,SQL_NULL_HANDLE,&henv);
SQLSetEnvAttr(henv,SQL_ATTR_ODBC_VERSION,(void *)SQL_OV_ODBC3,0);
SQLAllocHandle(SQL_HANDLE_DBC,henv, &hdbc);
SQLConnect(hdbc,pmydsn, SQL_NTS, pmyuid, SQL_NTS, pmypwd, SQL_NTS);
Now after this connection is established I try to get the status by calling the following function;
SQLGetConnectAttr(hdbc,SQL_ATTR_CONNECTION_DEAD,&value,sizeof(SQLINTEGER),&strln);
I get back value = 0 implying the connection is still active.
now i manually stop the MySQL server from the command prompt and again execute the same function but i still get back value = 0 .
Can u help me to figure out where i m going wrong and making a blunder.
ur prompt reply is highly recommended
Nitin Bansal
|
|
|
|
|
Hi everyone!
First, I appologise for my last post !
Anyway, got this here code in main():
int number1 = 5;<br />
int number2 = 10;<br />
<br />
int *p_number1 = &number1;<br />
int *p_number2 = &number2;<br />
<br />
int *arrayAddress;<br />
int *pointerArray[2];<br />
<br />
pointerArray[0] = p_number1;<br />
pointerArray[1] = p_number2;<br />
<br />
cout << " Pointer array at [0]: " << pointerArray[0];<br />
cout << endl;<br />
cout << " Pointer array at [1]: " << pointerArray[1];<br />
<br />
cout << endl;<br />
cout << endl;<br />
<br />
cout << " Pointer array deref at [0]: " << *pointerArray[0];<br />
cout << endl;<br />
cout << " Pointer array deref at [1]: " << *pointerArray[1];<br />
<br />
cout << endl;<br />
cout << endl;<br />
<br />
arrayAddress = pointerArray[0];<br />
<br />
cout << endl;<br />
cout << " Array address: " << arrayAddress;<br />
cout << endl;<br />
cout << " Array access through address: " << arrayAddress[0];
It compiles and the last statment prints 5 the actual value at the address that is stored in pointerArray[0] . But if I was to put arrayAddress[1] I get garbage.
Question: I have a class that contains the above code, or an array that points to a bunch of variables. Is there a way to pass the name of the array
outside the class private: to main() and then access it as if i was inside the class.
I am asking because I have a class private: filled with 24 variables, and got 24 members in public: that can return the current value of those variables. To shrink the class I decided to make an array of pointers to those variables and pass it outside the class so that instead of using the member functions I would lookup/change values directly thru the array of pointers.
If you have another solution to this problem PLEASE HELP!
Thanks for your time!
|
|
|
|
|
This is wrong in so many ways.
To answer the last question first - try writing an [] operator for the class to give access to the variables in the class. Then you can do things like boundary checks for the index etc, and you won't be directly exposing private data.
As for the actual code you wrote.
arrayAddress = pointerArray[0];
makes arrayAddress point to number1 .
Writing arrayAddress[0] dereferences the pointer to get the value of number1.
Writing arrayAddress[1] dereferences a pointer one integer past the memory location of number1, number2 might be stored there but probably not. You need to check your usage of pointers.
|
|
|
|
|
Mike Beckerleg wrote:
This is wrong in so many ways.
You are right!
But I found the code bellow to work just right:
void arrayAddressFunct(int *array[], int index)<br />
{<br />
cout << endl;<br />
cout << " Array address: " << array;<br />
cout << endl;<br />
cout << " Array access through address at index: " << *array[index];<br />
};
If the pointerArray address is passed to first argument and the desired index to the second then the function has access to the array at any index. It can actualy be used to return/change the values pointed to by the array.
This is what I wanted to do in the first place.
A question though: Is it a good idea to do the following?
Say a got a class/etc. containing a bunch of variables and I declare an array pointing to those variables. Then I write a two members which when accessed outside of the class in the form described by the code above can change and return the variables pointed to thru the array.
Or is there a better way to keep the variables safe but still have access to them without having to write a pile of members for access/change/return of the values.
|
|
|
|
|
I'm a bit confused about what you are trying to achieve but here goes.
If your class contains an array of values that you want to be able to access then write an operator[] method such as:
<br />
class SomeClass<br />
{<br />
public:<br />
<br />
const double& operator[](const int index) const<br />
{<br />
return mArray[index];<br />
}<br />
<br />
double& operator[](const int index)<br />
{<br />
return mArray[index];<br />
}<br />
<br />
private:<br />
double mArray[30];<br />
};<br />
Obviously you would put in some sort of bounds checking on the index value.
However from what you are saying the values you are trying to access are not currently in an array, why not? What are these data items? It sounds like they are unrelated items and you just want the array to save having to write accessor methods. If that is the case you may as well just make them public which is what your method would do!
|
|
|
|
|
Thanks for your time!
I know the questions are a bit $#@^ed up, but I'm just a newb!
I sorted the whole mess out, I got the class to do what I want and it is now like 20 times smaller .
Once again thanks for your help!
|
|
|
|
|
Hi!
I have a known URL on my cpu, for e.g. “C:\Temp\myFiles” that contains some files. I’d like to make a zip-file of all the files. If possible also zip the “myFiles” folder and all its containing files.
_____________________________
...and justice for all
APe
|
|
|
|
|
|
HI,
I want to handle a device through a web page.
means a i open a web page and i will give an IP ( and Socket if neccessry )in it
it will send data to IP where my device is.
and aslo recive data from that and display it in web page
what is a right way to do this.
1... Using COM DLL on Server where Web page resides.
2... OR made Web Services ( as of Dot Net). that handles these activites.
or there is any other way to do this.
any sample etc ...
thanx
Regards.
|
|
|
|
|
Hi
I have few edit boxes in a Dialog window.
Now I want to process the characters entered in each edit boxes.
I dont want to use OnChar or OnKeyDown becouse it will process all those messages to the main window. I just want to process the messages only when user types something in the edit box. How can I do that.
btw: this is for finding some unwanted characters like @#@#!@$ being entered in the certain edit box.
Thanks
Regards
The Best Relligion is Science.
Once you understand it, you will know God.
|
|
|
|
|
Hi,
One solution is to implement the WM_CHANGE message. Each time it is called you will check the edit boxes...
Well... I am a beginner ...
|
|
|
|
|
Hi
Thankyou.
It will work. But I want to get each character by character entered into the edit box.
Regards
The Best Relligion is Science.
Once you understand it, you will know God.
|
|
|
|
|
maybe you should read an article about a validating edit control?
click me
|
|
|
|
|
Enhanced Focus Edit Control with Input Filtering
[^]
My control does filtering of input (also via paste operations). IIRC, I could not get the WM_CHAR message to reflect from the control, so I used PreTranslateMessage on the edit control class itself, so I would only get WM_CHAR messages for that control.
Peace!
-=- James
Tip for inexperienced drivers: "Professional Driver on Closed Course" does not mean "your Dumb Ass on a Public Road"! Articles -- Products: Delete FXP Files & Check Favorites
|
|
|
|
|
Hi
I tried it but I was concerned about the processing.
Anyway I think I will be doing this
Thankyou for putting up suggestion
Regards
The Best Relligion is Science.
Once you understand it, you will know God.
|
|
|
|
|
Hi Friends,
There are lot many articles available on message routing.Still I am having some basic quries:
please consider 2 cases for messages (windows messages & Command messages)
Q 1. In SDI/MDI, how routing takes place?
Q 2. In case of command message if a class is handling that, What about other classes in route.
Q 3. It seems that, some messages are not handled by framework, I did not get them even after installing windows hooks (like WM_LBUTTONDOWN on caption bar) Why it so?
Vikram S
|
|
|
|
|
I wana to write a application using MFC & Nero sdk, this application will just simply burn selected folder into CD/DVD-rom, but after I read though the sdk manual and play around a sample application called NeroFiddles comes with sdk, but it can only burn files. How can I burn directories? any ideas everybody? sample code will be appreciated.
|
|
|
|
|
has any1 gone thru scanlogd?
i downloaded the source and binary. compiled without error. now when i run the binary and try to nmap on the machine, nothing happens. its using syslog.. can any1 tell me where to syslog log? or how to use scanlogd on windows?
|
|
|
|
|
void CAboutDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
if(nFlags == MK_LBUTTON)
{
MessageBox("hi");
}
CDialog::OnLButtonUp(nFlags, point);
}
works beautifully, my question is what coding should i use so that the message box appears only if the left click is on a Static Text( ex: IDC_STATIC3) ... i understand how to detect the location of the click using point, but can i also use the point for detecting the actual ID being clicked on, not just the point on the screen?
|
|
|
|
|
|
persian_boi wrote:
CDialog::OnLButtonUp(nFlags, point);
I hope this is a typo, you are calling the wrong base class. It ought to be OnLButtonDown
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fruity and sweet. I'm jelly, what am I? Muse on it further, I shall return! - David Williams (Little Britain)
|
|
|
|
|
I need to do a code on editing of .avis & .mpegs.
Where can i find such codes around or does anyone has come across such cases?
Can someone show me some source codes on how to do basic editing like cutting and pasting of video frames in .avis & .mpegs format.
Tks
|
|
|
|
|
if your editing only does cutting & pasting of frames, you could try directx sdk from microsoft, by using dx sdk you can snapshot frames from video stream, after that any image editor will help you with graph editing.
|
|
|
|