Hello everyone, my name is Vincent, and I am hoping to get help with this subject.

--
Visual C++ 2008 Express
--

Alright, basically I have a droplist combobox with 8 lines

1
2
3
4
5
6
7
8

that a user can select. I want to have it so that, say "5" is selected from the options, "hppot" will press key 5. Right now I'm using "VkKeyScan(53)" as that is tied to key 5, but how can I get the selected number from the drop down box and have that number be the actual keypress, also without converting it to "53"?

void hppot()
{
	
keybd_event((BYTE)VkKeyScan(53), MapVirtualKey(VkKeyScan(53), 0), 0x0000, 0);
Sleep(50);
keybd_event((BYTE)VkKeyScan(53), MapVirtualKey(VkKeyScan(53), 0), KEYEVENTF_KEYUP, 0);
Sleep(50);
}

Before I even got into that, I tried using a string

void hppot()
{
int FCb = comboBox1->Text;

keybd_event((BYTE)VkKeyScan(FCb), MapVirtualKey(VkKeyScan(FCb), 0), 0x0000, 0);
Sleep(50);
keybd_event((BYTE)VkKeyScan(FCb), MapVirtualKey(VkKeyScan(FCb), 0), KEYEVENTF_KEYUP, 0);
Sleep(50);
}

Which results in the error
"error C2664: 'VkKeyScanA' : cannot convert parameter 1 from 'System::String ^' to 'CHAR'"

Bumped because it fell on another page.

If my question was against the rules, at least inform me -- so many views and not even one single response.

bump....

It has been two days, was curious if there was anyone willing to help me?

It's been 32 days, was wondering if anyone could lead me in the right direction?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.