|
Hi All,
1) I have an MFC form view application which will have some push buttons on it. I want to connect these push buttons by arrow lines. What I mean is when I run the application the push buttons has to be shown by conncted to each other by arrow lines .. How can I do this ?
|
|
|
|
|
Use MoveTo and LineTo GDI calls in the OnPaint function of the dialog class.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Could someone direct me to a source of information on how is F1 key processed in "standard" MFC application. I would like to intercept other function keys to change focus to various controls in CFormView derived view. I have been experimenting with PreTranslateMessage and OnHelpInfo but need some guidance here.
Thanks for you help
Cheers Vaclav
modified on Thursday, June 18, 2009 3:10 PM
|
|
|
|
|
There is some information concerning context-sensitive help support of MFC on MSDN. You may want to examine MFC source files like winfrm.cpp, winfrmx.cpp and apphelpx.cpp for CFrameWnd and CWinApp classes.
You may use accelerator table resources to intercept other keys like F1 below.
IDR_MAINFRAME ACCELERATORS PRELOAD MOVEABLE PURE
BEGIN
VK_F1, ID_CONTEXT_HELP, VIRTKEY, SHIFT
VK_F1, ID_HELP, VIRTKEY
END
You may also benefit from mnemonic keys for form controls.
|
|
|
|
|
|
if(pMsg->message==WM_KEYDOWN && pMsg->wParam==112)
{
}
i used it this way in oneof my apps in pretranslatemessage. it worked.
--------------------------------------------
Suggestion to the members:
Please prefix your main thread subject with [SOLVED] if it is solved.
thanks.
chandu.
|
|
|
|
|
Found a solution thanks to the forum using PreTranslateMessage in CFormView. Also found Q222829 article very helpful but confusing. Is it really necessary to run TranslateAccelerator ? Also I do not see why Accelerator resource is also in the picture.
Addendum - Apparently it is necessary to use TranslateAccelerator and other functions when the accelerator key is in menu.
I am including (for review only – it is redundant) two ways to retrieve the VK_F2 (function key F2 ) , they both accomplish same result.
Of course the de-reference symbol is as always “->” and not “->”. I really do not know why, but is it not my mistake!
Thanks guys Vaclav
BOOL CFD2008View::PreTranslateMessage(MSG* pMsg)
{
// TRACE("\n BOOL CFD2008View::PreTranslateMessage(MSG* pMsg) ");
if (m_hAccelTable) {
if (::TranslateAccelerator(m_hWnd, m_hAccelTable, pMsg)) {
{
if(pMsg->wParam==VK_F2)
{
TRACE("\nBOOL CFD2008View::PreTranslateMessage(MSG* pMsg) VK_F2");
m_edit.SetFocus();
}
return(TRUE);
}
}
}
if(pMsg->message == WM_KEYDOWN)
{
if(pMsg->wParam==VK_F2)
{
TRACE("\nBOOL CFD2008View::PreTranslateMessage(MSG* pMsg) VK_F2");
m_edit.SetFocus();
}
}
{
// Let the ToolTip process this message.
m_tooltip.RelayEvent(pMsg);
}
return CFormView::PreTranslateMessage(pMsg);
}
modified on Thursday, June 18, 2009 3:40 PM
|
|
|
|
|
Hello. I would like to create an alias to an array of pointers, but don't know the syntax for such an operation. For example, to create an alias, "b", to an integer, "a", I would do the following:
int a;
int &b(a); Here changing either b or a also modifies the other. However, how do I do this if the type of a is an array of double* const, as in the following:
double* const a[2];
double* const (&b)[2](a); Is the second line doing what I want it to, and creating an alias for a? If this is not correct, does anyone know how to do this? Thanks,
Sounds like somebody's got a case of the Mondays
-Jeff
|
|
|
|
|
|
The way to make it easier to parse (by you, not the compiler!) is to split the type definition from the reference declaration:
typedef double* const MyArrayType[2];
MyArrayType a = { whatever };
MyArrayType& b = a;
Simpler, no?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
hi,
May i know when to use smart pointers than ordinary pointers....
|
|
|
|
|
pradeep455 wrote: May i know when to use smart pointers than ordinary pointers....
First you should know when to use Google [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Whenever you're responsible for allocating/deallocating resources.
Which (for my programs, at any rate) is 90% of the time.
For COM, use _com_ptr_t (in the guise of COM_SMARTPTR_TYPEDEF). For BSTR, use _bstr_t. For 'normal' pointers, use Boost smart pointers[^].
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi There !!!
Let's find someone who could help me on this problem.
I have created on VS2005 under Windows Vista a new Visual C++ ATL Server Web Service Project with:
Blob Cache
Session Services (Memory-backed session-state service)
I compiled the project sucessfully. Then, i opened IExplorer and access de URL to generate the WSDL.
The WSDL of the web service was generated with sucsess.
This is my problem:
With this simple and basic project, i changed the configuration properties to support Common Language Runtime Suport, Old Syntax (/clr:oldSyntax)
The compilation of the project was made successfully.
The problem was when i go to access the web service to generate the WSDL via web browser.
I access the URL (something like: http://localhost/ATLWS1/ATLWS1.dll?Handler=GenATLWS1WSDL) on IExplorer, and the web browser hangs and no result is returned.
Just a page indicating that "Internet Explorer cannot display the webpage".
There some dependency or configuration missing to support CLR ?? I tried the same scenario on Windows XP and this works fine.
|
|
|
|
|
Hi All,
I am working on a project with MFC and i need one of my windows to display the user detailes(First Name, Last Name, WorkPhone and Personal Phone) who logged into the computer. I Can use MAPI or CDO for this, access the address book, iterate thru the users and get the detailes.
Is there a way that i can use to identify the current user address book detailes instead of iterating thru the address book.
Some sample codes will help me.
Thankyou,
Kasi
|
|
|
|
|
The CDO Session object has a CurrentUser[^] property...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
actually i wanted to develop a program such that it restores the original mac address...
also if u can help me out with a program such as to verify a username and password along with a mac address stored in a file....the program used by isp's...
|
|
|
|
|
Hi Friends
How to use scrollbar (horz & vert ) in CStatic derived class
thanks in advance
-kk.tvm-
|
|
|
|
|
Are you wanting to know how to actually use one, or implement one?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi
I like to show a picture in Dialog box with zooming facilities
I derived a class from CStatic
I enabled horizontal and vertical scroll bar using ModifyStyle in PreSubClassWindow
I already set other details using Scrollinfo and OnHScoll and OnVScoll
but i can't scroll image using arrows and thumb in scroll bar
how can i solve this ?
-kk.tvm-
|
|
|
|
|
here i have a clue. but not sure weather it suits your requirement.
take the scroll bars outside your control,
in the on hscroll and on vscroll events, or on hitting the arrows,
increment/decrement the co ordinates of the image wrt. the control appropriately.
i remember, long back, when i had to display a big city map on my dialog,
i had to do the same thing for panning and zooming the map.
good luck.
|
|
|
|
|
You better use scrollbars in a scrollview. (it is complicated enough)
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
hi, i am doing some socket programming. the problem is that when i use the port number 80, then the error is 10051 which means Network is unreachable, but my network is working find. also when i use any random number for port, the error is 10061 which means Connection refused.
please guide me. here is my code ----
#include <windows.h>
#include <winsock.h>
#include <stdio.h>
#define NETWORK_ERROR -1
#define NETWORK_OK 0
void ReportError(int, const char *);
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrevInst, LPSTR lpCmd, int nShow)
{
WORD sockVersion;
WSADATA wsaData;
int nret;
struct in_addr addr;
addr.s_addr = inet_addr("127.0.0.1");
sockVersion = MAKEWORD(1, 1);
WSAStartup(sockVersion, &wsaData);
LPHOSTENT hostEntry;
hostEntry = gethostbyaddr((char *) &addr, 4, AF_INET);
if (!hostEntry)
{
nret = WSAGetLastError();
ReportError(nret, "gethostbyaddr()");
WSACleanup();
return NETWORK_ERROR;
}
SOCKET theSocket;
theSocket = socket(AF_INET,
SOCK_STREAM,
IPPROTO_TCP);
if (theSocket == INVALID_SOCKET)
{
nret = WSAGetLastError();
ReportError(nret, "socket()");
WSACleanup();
return NETWORK_ERROR;
}
SOCKADDR_IN serverInfo;
serverInfo.sin_family = AF_INET;
serverInfo.sin_addr = *((LPIN_ADDR)*hostEntry->h_addr_list);
serverInfo.sin_port = htons(80);
nret = connect(theSocket, (LPSOCKADDR)&serverInfo, sizeof(struct sockaddr));
if (nret == SOCKET_ERROR)
{
nret = WSAGetLastError();
ReportError(nret, "connect()");
WSACleanup();
return NETWORK_ERROR;
}
MessageBoxA(NULL, "Great, it is good", "socket Successful", MB_OK);
closesocket(theSocket);
WSACleanup();
return NETWORK_OK;
}
void ReportError(int errorCode, const char *whichFunc)
{
char errorMsg[92];
ZeroMemory(errorMsg, 92);
sprintf_s(errorMsg, "Call to %s returned error %d!", (char *)whichFunc, errorCode);
MessageBoxA(NULL, errorMsg, "socketIndication", MB_OK);
}
|
|
|
|
|
not sure I fully understand your issue
you've created a tcp socket client app
1) you try to connect to (local loopback address 127.0.0.1) on port 80 and get an error - do you have an ethernet adaptor, and tcp/ip set up on your machine ? - you should be able to ping yourself on 127.0.0.1 and get a valid response before you try this - then you'll need something listening on port 80 - depending on what sort of a machine, it could be IIS for example, or a server harness
2) you try a random port - unless you fix the issues at (1), its not going to work AND you would need something listening on all the ports on machine to catch the connect on a 'random' port - I dont see what a random port does for your case
'g'
|
|
|
|
|
thanks for the reply.
i can ping 127.0.0.1 easily and getting a valid output.but i dont know how to ping using a port. i have 2 ethernet adaptors, one is used for internet and other is spare. my internet is working find, so port 80 is also working well ??
|
|
|
|