[Solved] Show Yes/No messagebox where No is grayed out win32api C++ [closed]

Use SetWindowsHookEx() or SetWinEventHook() with a thread-local hook to capture the MessageBox() dialog’s HWND, then you can use EnableWindow() to disable the button. Here is how to do it using SetWindowsHookEx(): HHOOK hHook = NULL; LRESULT CALLBACK CBTProc(int nCode, WPARAM wParam, LPARAM lParam) { if( nCode == HCBT_ACTIVATE ) { HWND hDlg = (HWND) wParam; … Read more

[Solved] Operators I didnot understand [closed]

<< >> These are the shift operators. They shift the left operand by the number of bits given in the right operand. The direction of the shift depends on which of the two operators was used. ^ This is the bitwise exclusive OR operator. The result will have bits set where only one of the … Read more

[Solved] Read file with floats, calculate size, max, min, mean, median and standard deviaton in C [closed]

float x,i=~(257<<23),a,s,t;main(int n,char**f){a=-i;f=fopen(f[1],”r” );for(n=0;fscanf(f,”%f”,&x)>0;n++,s+=x,x<i?i=x:0,x>a?a=x:0,t+=x*x); printf(“%d %f %f %f %f\n”,n,a,i,s/n,sqrtf(t/n));} Sorry for the long code. Didn’t have time to make it shorter. 1 solved Read file with floats, calculate size, max, min, mean, median and standard deviaton in C [closed]

[Solved] Entering value to database after pressing enter from a textbox [closed]

Use for this KeyDown event private void YourTextBox_KeyDown(object sender, KeyEventArgs e) { String connection= “Data Source=YourServer;Initial Catalog=YourDatabase;user=User;password=YourPassword;Integrated Security=True;”; if (e.KeyCode == Keys.Enter) { string insertCmdText = “INSERT INTO table(column1)values(@valueForColumn1)”; SqlCommand sqlCom = new SqlCommand(insertCmdText,connection); sqlCom.Paramaters.AddWithValue(“@valueForColumn1”,YourTextBox.Text); connection.Open(); sqlCom.ExecuteNonQuery(); connection.Close(); } } But consider that saving into Database after KeyPress event is not a right way to … Read more

[Solved] What is wrong using c++ copy function?

std::copy is going to use vector as an array. You have to resize it, so it can store all needed values. You can also use std::back_inserter. It will resize vector when necessary. 4 solved What is wrong using c++ copy function?

[Solved] How to Convert C++ sscanf_s() function to C# [closed]

If I understand the function of sscanf_s correctly from Martin Bonner’s explanation, you are looking for how to convert a string that represents hexadecimal digits into an int. You can do so with the following: iHex = Convert.ToInt32(sHex, 16); This being said, whether or not you want to actually use int for your conversion result … Read more

[Solved] Double data insert into database asp.net c#

You have two bad practices going on here. First, you should use sql parameters instead of simply concatenating them; to avoid SQL injection. Read here. Second, don’t do an insert in a HTTP GET (Page_Load). You should do this in a HTTP POST and then redirect to an HTTP GET again (PRG pattern). The reason … Read more

[Solved] How do i enter 10 numbers in array? [closed]

I believe this is a Home work question! Anyways write a separate method void GetTenNumbers(int arr[]){ for(int counter =0; counter <10; counter ++){ cout<<“Enter number “; cin>> arr[counter]; } } and do something like this case 1: { cout<<“Enter 10 numbers: “; GetTenNumbers(arr); break; } solved How do i enter 10 numbers in array? [closed]