|
I'm going to create a program that does a search in a list control. I want that the user types the keyword in the search box and the program selects the appropriate column.
It's an MFC Dialog based program, i use MS VC++ 2005 and i am not an very experienced programmer.
I just need to know what does select an item/column in the list.
Thanks in advance!
|
|
|
|
|
See documents for GetItem for each item on the list we have image,text,state and lparam but GetItem returns only an item at a time so you can use of a loop for search list
you can set mask = LVIF_TEXT; and on the loop search list.
|
|
|
|
|
I need to store an image(like a company logo) on the printer permanent memory and the need to print it on a paper at desired location whenever required (using postscript printer language). How can I save an image on the printer? Using command line, printer driver, anything... I'm completely frustrated browsing the web for this. Does anyone knows anything about this? I know this is not a C++ question but I am sure you smart guys know about this. Please help me. Please point me to some link or ant sample code.. something...at all.
|
|
|
|
|
Unhandled Exception: System.Net.Sockets.SocketException: No connection could be
made because the target machine actively refused it
at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
at AsyncServer.InitSocks()
i get this message after compilation of the code in the console window.Does anyone know how to resolve this issue?Thanks
|
|
|
|
|
|
|
if only you were :
1) expressing yourself clearly
2) asking the correct forum (this is Managed C++ or C++/CLI)
3) explaining what you had tried first before expecting too much of us
4) giving full error messages and a related and relevant code
|
|
|
|
|
This is my code which is probably causing the error:
void AsyncServer::InitSocks()
{
String* server = "CATUXPSD01";
int port = 4901;
printf("in InitSocks");
String* request = String::Concat(S"Our test data asdf");
Byte bytesSent[] = Encoding::ASCII->GetBytes(request);
Byte bytesReceived[] = new Byte[256];
Socket* s = 0;
IPHostEntry* hostEntry = 0;
// Get host related information.
hostEntry = Dns::Resolve(server);
// Loop through the AddressList to obtain the supported AddressFamily. This is to avoid
// an exception that occurs when the host IP Address is not compatible with the address family
// (typical in the IPv6 case).
IEnumerator* myEnum = hostEntry->AddressList->GetEnumerator();
while (myEnum->MoveNext())
{
IPAddress* address = __try_cast<ipaddress*>(myEnum->Current);
IPEndPoint* endPoint = new IPEndPoint(address, port);
Socket* tmpS = new Socket(endPoint->AddressFamily, SocketType::Stream, ProtocolType::Tcp);
tmpS->Connect(endPoint);
if (tmpS->Connected)
{
s = tmpS;
break;
}
}
// Create a socket connection with the specified server and port.
if (s == 0) {
printf("Connection failed");
} else {
// Send request to the server.
s->Send(bytesSent, bytesSent->Length, static_cast<socketflags>(0));
}
}
So a socket is being created so I can send data. My problem is that when there is nothing listening on the port I don't want the program to generate the error, I want to trap the error and do something with it.
|
|
|
|
|
but still you're asking a C++/CLI question in the wrong forum...
|
|
|
|
|
|
What are Visual Studio 2003 Keyboard Shortcuts for Find Results pane?
I have several items in my 'find results pane' at bottom of screen. When I click on one item, the source file opens up and cursor is put to line. What is shortcut key to advance to next item int he find results list? For example, in Visual Studio 6.0, you could press F4 to automatically advance to next item. When I press F4 in VS 2003, I just get some 'properties' pane opening up on right of screen.
Thanks in advance for any help on this - the MS help was worthless...
|
|
|
|
|
Hi everybody!!!
I want to change value of static text in Dialog, but I can't do it.
I try to do another way, example:
SetDialogText(hDlg,ID_STATIC,"example")
Notice: I use WIN32 API not MFC
Please show me how to do it
Thanks so much...
|
|
|
|
|
Use SetDlgItemText(hDlg, ID_STATIC, "Example");
|
|
|
|
|
You can use of WM_SETTEXT message.
|
|
|
|
|
Need help with Midistation...I want to write a FUNCTION in Visual C++ that will SET A FLAG to turn note on when note turns off...
DIRECTX DIRECT MUSIC
IF NOTE = OFF
THEN NOTE = On
What MIDISTATION source do I use from the MIDISTATION FOLDER????
I'm using MIDISTATIONDIG.CPP FILE..Is This correct???
//////////////////////////////////////////////////////////
Function called when the keyboard sends a note to the port
IF NOTE = OFF THEN NOTE = ON
/////////////////////////////////////////////////////////
Rance_Wilson
|
|
|
|
|
Need help with Midistation...I want to write a FUNCTION in Visual C++ that will SET A FLAG to turn note on when note turns off...
IF NOTE = OFF
THEN NOTE = On
What MIDISTATION source do I use from the MIDISTATION FOLDER????
I'm using MIDISTATIONDIG.CPP FILE..Is This correct???
//////////////////////////////////////////////////////////
Function called when the keyboard sends a note to the port
IF NOTE = OFF THEN NOTE = ON
/////////////////////////////////////////////////////////
Rance_Wilson
|
|
|
|
|
hi
would like to know if the following is possible:
a windows program written in c++ that allows you to submit a form and store the contents of the form in a database and retrieve/edit/delete information in the database. i can do this in asp, but would like to create an c++ application that does the same thing
if not is there another way to achieve a windows standalone application
regards
very new to c++ programming
|
|
|
|
|
Yes, it's possible.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
It is possible, but if you are very new to C++ and experienced with ASP, better use something like VB (I can't believe I wrote that )
|
|
|
|
|
Nemanja Trifunovic wrote: I can't believe I wrote that
I don't think any of us can believe you said that!
|
|
|
|
|
I'm expecting sincere apologies
codito ergo sum
|
|
|
|
|
|
I am writing a short piece of code to broadcast a UDP packet over a network. It initialises the socket system, created a DGRAM socket, broadcasts the packet and then closes the socket. My problem is that when the Close() function is called it crashes with the message
HEAP[Test.exe]: Invalid Address specified to RtlFreeHeap( 01470000, 0147425C )
Here is the snippit of code :
#define BROADCAST_PORT 9122<br />
<br />
CAsyncSocket m_Broadcast_Socket;<br />
char Data[] = "1234567890";<br />
int Bytes_Sent;<br />
BOOL Value;<br />
<br />
<br />
AfxSocketInit();<br />
<br />
VERIFY(m_Broadcast_Socket.Create(BROADCAST_PORT, SOCK_DGRAM));<br />
Value = TRUE;<br />
VERIFY(m_Broadcast_Socket.SetSockOpt(SO_BROADCAST, &Value, sizeof(BOOL)));<br />
Bytes_Sent = m_Broadcast_Socket.SendTo((LPCTSTR)Data, 3, BROADCAST_PORT);<br />
DWORD Error = GetLastError();<br />
m_Broadcast_Socket.Close();
I can see the packet on my network monitor.
If I take out the SendTo call I have no crash.
If I take out the Close call the destructor crashes (again in the Close call).
What am I doing wrong ?
|
|
|
|
|
Anorexic Tribble wrote: What am I doing wrong ?
One guess is that you did not call Shutdown(..) and the other thing I would note is that you are using an Asynchronous Socket in serial fashion.
Are you following a book, article or tutorial? If so please reference it.
|
|
|
|
|
I put in the Shutdown call, but that made no difference. It be honest at the moment my small routine is the only thing sending and nothing receiving (at the moment). But good idea to put Shutdown call in.
I used an async socket because eventually I will be sending and receiving in a non linear fashion.
I'm using bits and pieces from various articles. To be honest I haven't found a really good one that deals specifically with DGRAM sockets. MSDN for example mixes its description of DGRAM and STREAM sockets to provide a very confusing piece if spaghetti writing. Do you know of any good articles?
|
|
|
|