|
yeap you are right
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
how do i implement this as well...please help me with some example as well with a few reference as well.Thank you
|
|
|
|
|
How do i implement this...please do help me ...an example would be really thankful with links as well.
|
|
|
|
|
Would you rather us just come over to your place and code it up? I think that would be the most beneficial for all parties involved.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Feeling a bit snarky today, eh?
Not that I have *ever* left a sarcastic reply to a silly question. Noooo, not me.
Iain.
|
|
|
|
|
Admittingly, yes. But I still refrain from being rude.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hello,
I am tying to resize a window in the WM_SIZE message handler but I am not able to resize it properly.
What is cx,cy ?
It says it is new width and height of the client window but how do I use it to modify the window?
What are the co-ordinates I should start with?
Regards
Prithaa
|
|
|
|
|
If you are looking for restrict sizing dynamically, WM_SIZE is not the place. You have to use WM_WINDOWPOSCHANGING instead. Or if you need to just size the window, you can call SetWindowPos, or MoveWindow.
- NS -
|
|
|
|
|
hai...
cx and cy are new width and height only...but at that time of dragging ur window..u will get the new position rite?
which means ...when ever u r dragging or resizing ur window at that time u need to catch the x and y values at that point which u dragged....then pass that values to cx and cy.....this is the new width and height of ur window..
|
|
|
|
|
Hello,
Thanks for the replies.
But how can I catch the the new width and height?
I want to write window restored minimize maximize.
It is confusing to conclude which message handler (WM_SIZE WM_SIZING) to use.
Regards,
Prithaa
|
|
|
|
|
if you want to set the window maximun and minium width and height, then take a look at WM_GETMINMAXINFO message, this message will be sent to all the window by the framework, just fill the MINMAXINFO struct, rest will be taken care by the framework itself
Hope it will help...
Do your Duty and Don't expect the Result
|
|
|
|
|
C++ has several utilities to manipulate strings declared as char var;, i.e. strncpy(a,b,n); where a,b are strings, n is the number of characters, etc. However, when one declares a variable as a CString, and uses the same utility, the compiler says that it cannot convert the CString to a char variable. Are there other C++ or visual C++ 6.0 utilities to work with CString variables? Please provide help on this subject. Thanks, Sid Kraft
Sid
|
|
|
|
|
When you need a const string you can use a CString directly.
When it's being used in a non-const fashion, use CString::GetBuffer.
char *strncpy( char *strDest, const char *strSource, size_t count );
(i.e. Here you can use CString as is for the second parameter since the LPCTSTR operator kicks in. If you use CString for the first parameter, you need it to be non-const. In other words, you need a buffer, so use CString::GetBuffer as the first parameter and later calling CString::ReleaseBuffer before calling any other CString member functions.)
|
|
|
|
|
cast it to (LPTSTR)(LPCTSTR)CString Object
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
|
Michael Dunn wrote: That has to be a joke.
thats the great mistake i have done!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
But why great mistake?;);P
|
|
|
|
|
sidkraft wrote: However, when one declares a variable as a CString, and uses the same utility...
And why in the world would you want to do that?
sidkraft wrote: Are there other C++ or visual C++ 6.0 utilities to work with CString variables?
They are called methods, and CString has plenty of them.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
im following this article here not quite getting it to work
http://www.codeproject.com/internet/beginningtcp_cpp.asp
Listening for connection code:
int ListenOnPort(int portno, HWND hwnd)
{
SOCKET s;
WSADATA w;
int error = WSAStartup (0x0202, &w); // Fill in WSA info
if (error)
{
return false; //For some reason we couldn't start Winsock
}
if (w.wVersion != 0x0202) //Wrong Winsock version?
{
WSACleanup ();
return false;
}
SOCKADDR_IN addr; // The address structure for a TCP socket
addr.sin_family = AF_INET; // Address family
addr.sin_port = htons (portno); // Assign port to this socket
//Accept a connection from any IP using INADDR_ANY
//You could pass inet_addr("0.0.0.0") instead to accomplish the
//same thing. If you want only to watch for a connection from a
//specific IP, specify that //instead.
addr.sin_addr.s_addr = htonl (INADDR_ANY);
s = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP); // Create socket
if (s == INVALID_SOCKET)
{
return false; //Don't continue if we couldn't create a //socket!!
}
if (bind(s, (LPSOCKADDR)&addr, sizeof(addr)) == SOCKET_ERROR)
{
//We couldn't bind (this will happen if you try to bind to the same
//socket more than once)
return false;
}
//Now we can start listening (allowing as many connections as possible to
//be made at the same time using SOMAXCONN). You could specify any
//integer value equal to or lesser than SOMAXCONN instead for custom
//purposes). The function will not //return until a connection request is
//made
int tempi = listen(s, SOMAXCONN);
WSAAsyncSelect (s, hwnd, MY_MESSAGE_NOTIFICATION, (FD_ACCEPT | FD_CONNECT |FD_READ | FD_CLOSE));
//Don't forget to clean up with CloseConnection()!
closesocket(s);
::MessageBox(NULL,"Done Listening ", "Got Request..", MB_OK);
}
//--------------
Look out for the events code:
switch (message)
{
case MY_MESSAGE_NOTIFICATION: //Is a message being sent?
{
switch (lParam) //If so, which one is it?
{
case FD_ACCEPT:
::MessageBox(NULL,"Done Listening Event", "Got Request..", MB_OK);
//Connection request was made
break;
case FD_CONNECT:
::MessageBox(NULL,"Done Listening Event", "Got Request..", MB_OK);
//Connection was made successfully
break;
case FD_READ:
//Incoming data; get ready to receive
break;
case FD_CLOSE:
//Lost the connection
::MessageBox(NULL,"Done Listening Event", "Got Request..", MB_OK);
break;
}
}
break;
case WM_KEYDOWN:
ListenOnPort(888, hWnd);
break;
..
the problem is i dont' seem to be getting any of these events FD_ACCEPT | FD_CONNECT |FD_READ | FD_CLOSE
|
|
|
|
|
You won't get any messages if you close the socket before doing
anything with it.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
If I have many projects that use the same MFC extension libraries, how can I set up the preprocessor stuff in each projects stdafx.h file to point to a common location for the .lib, .dll, and .h files?
For instance, this is what I'm trying but it's not quite as nice and tidy as I'd hope and I'm not sure how to direct the project to the .dll's using some similar approach.
// Class includes
#include "..\\..\\Lib\\SomeLib1\\class1.h"
// Library Stuff
#ifdef _DEBUG
#pragma comment(lib, "..\\..\\Lib\\SomeLib1\\Debug\\SomeLib1.lib")
#else
#pragma comment(lib, "..\\..\\Lib\\SomeLib1\\Release\\SomeLib1.lib")
#endif
|
|
|
|
|
I have 3 or more CSV files for each day saved in folder by each Month (September). When I open them for view as XLS it carry Master Data sheet. You can recognize the files for each day in the folder by date as following:-
abc_xyz1.xx.20070901
abc_xyz2.xx.20070901
abc_xyz3.xx.20070901 ..........so on
abc_xyz1.xx.20070902
abc_xyz2.xx.20070902
abc_xyz3.xx.20070902 ..........so on
abc_xyz1.xx.20070903
abc_xyz2.xx.20070903
abc_xyz3.xx.20070903 ..........so on
I want a Macro to open 1st csv file for that date & bring 2nd, 3rd ………files data to my 1st csv file by Adding sheet into 1st file & save the file with 1st file name.
So that when I open these file for that day I have all data into one file with multiple sheet.
I don’t know VBA at all, Please let me know if any one can help, it very urgent.
Thanks
|
|
|
|
|
So, is this a C++ question or you don't know how to program?
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
jsmotu wrote: I don’t know VBA at all
Just as well you're asking in a Visual C forum then! Just code up an quick application in C to do it. No need to use VBA at all!
More seriously, there's a unix command / applet called join which should help you. Just do a google search for "join.exe win32", and you should be deluged with options.
Iain.
|
|
|
|
|
how would i attach a bitmap image to a code source for a main program. Like if i wanted to add a bitmap to load with this program :
#include <windows.h>
/* Declare Windows procedure */
LRESULT CALLBACK WindowProcedure (HWND, UINT, WPARAM, LPARAM);
/* Make the class name into a global variable */
char szClassName[ ] = "WindowsApp";
int WINAPI WinMain (HINSTANCE hThisInstance,
HINSTANCE hPrevInstance,
LPSTR lpszArgument,
int nFunsterStil)
{
HWND hwnd; /* This is the handle for our window */
MSG messages; /* Here messages to the application are saved */
WNDCLASSEX wincl; /* Data structure for the windowclass */
/* The Window structure */
wincl.hInstance = hThisInstance;
wincl.lpszClassName = szClassName;
wincl.lpfnWndProc = WindowProcedure; /* This function is called by windows */
wincl.style = CS_DBLCLKS; /* Catch double-clicks */
wincl.cbSize = sizeof (WNDCLASSEX);
/* Use default icon and mouse-pointer */
wincl.hIcon = LoadIcon (NULL, IDI_APPLICATION);
wincl.hIconSm = LoadIcon (NULL, IDI_APPLICATION);
wincl.hCursor = LoadCursor (NULL, IDC_ARROW);
wincl.lpszMenuName = NULL; /* No menu */
wincl.cbClsExtra = 0; /* No extra bytes after the window class */
wincl.cbWndExtra = 0; /* structure or the window instance */
/* Use Windows's default color as the background of the window */
wincl.hbrBackground = (HBRUSH) COLOR_BACKGROUND;
/* Register the window class, and if it fails quit the program */
if (!RegisterClassEx (&wincl))
return 0;
/* The class is registered, let's create the program*/
hwnd = CreateWindowEx (
0, /* Extended possibilites for variation */
szClassName, /* Classname */
"Windows App", /* Title Text */
WS_OVERLAPPEDWINDOW, /* default window */
CW_USEDEFAULT, /* Windows decides the position */
CW_USEDEFAULT, /* where the window ends up on the screen */
544, /* The programs width */
375, /* and height in pixels */
HWND_DESKTOP, /* The window is a child-window to desktop */
NULL, /* No menu */
hThisInstance, /* Program Instance handler */
NULL /* No Window Creation data */
);
/* Make the window visible on the screen */
ShowWindow (hwnd, nFunsterStil);
/* Run the message loop. It will run until GetMessage() returns 0 */
while (GetMessage (&messages, NULL, 0, 0))
{
/* Translate virtual-key messages into character messages */
TranslateMessage(&messages);
/* Send message to WindowProcedure */
DispatchMessage(&messages);
}
/* The program return-value is 0 - The value that PostQuitMessage() gave */
return messages.wParam;
}
/* This function is called by the Windows function DispatchMessage() */
LRESULT CALLBACK WindowProcedure (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message) /* handle the messages */
{
case WM_DESTROY:
PostQuitMessage (0); /* send a WM_QUIT to the message queue */
break;
default: /* for messages that we don't deal with */
return DefWindowProc (hwnd, message, wParam, lParam);
}
return 0;
}
Michael
(Up and coming Game programmer)
EST
|
|
|
|
|