|
MrEyes wrote:
Why o why cant I start my C++ jaunt with a nice and simple Hello World app
You can. Just have the program say "Hello world" in response to a CEvent fired by a C# program and you are there!!
Good luck.
Dave
"You can say that again." -- Dept. of Redundancy Dept.
|
|
|
|
|
Hi,
I have a dialog based application. It uses connection oriented Windows Sockets. My application is not responding or responding very latter to the user interface messages like mouse and keybard input; When the network data traffic producing high amount of Socket messages like FD_READ.
How can I solve this. Is there a short method to filter and process mouse and keyboard messages before processing socket's FD_READ message.
Thanks and best regards.
|
|
|
|
|
It sounds like you might have the application waiting in socket read.
Maybe putting the read in a worker thread would sort your problem ? I've done this before and it worked fine.
Elaine
The tigress is here
|
|
|
|
|
Put your socket read code etal into a worker thread. This will free up the main thread to do all the standard message handling for keyboard, mouse etc.
Ant.
I'm hard, yet soft. I'm coloured, yet clear. I'm fuity and sweet. I'm jelly, what am I? - David Willaims (Little Britain)
|
|
|
|
|
Thank a lot for your response Mr Trollslayer and Mr Antony M Kancidrowski,
My socket routines are non blocking and fully event driven. I am using WinSock APIs. The socket reader routine is event driven and do not blocks application when data is not received. When FD_READ message receives it reads available data's and then returns.
The worker thread is good solution but I have to handle up to 1024 server connections. More than one server connection and data receiving process may require high amount of system resources with this solution.
The problem is that; I want to capture mouse and keyboard messages before FD_READ message handling.
Thanks anmd best regards
Erkan Ermis
|
|
|
|
|
Or in another word, Can I replace my mouse and keyboard messages on the top of the application message que. I heard that it is possible but I can not see a sample code up to now.
Thanks and best regards.
Erkan Ermis
|
|
|
|
|
Hi,
I have a CEdit derived class I want to use for all my edit buttons in a dialog (lets call it MyCEditBase).
I want to use a tool tip for each edit that is derived from MyCEditBase.
I added the definition
CToolTipCtrl m_wndToolTip;
to MyCEditBase header file.
Now I created and
I'm trying to use a tool tip for a CEdit control with the following code:
m_wndToolTip.Create(this);
m_wndToolTip.Activate(m_EnableToolTip);
m_ToolTipText = "Edit Button Text";
m_wndToolTip.AddTool(this, m_ToolTipText);
Now to show the tool tip I have to override PreTranslateMessage but this is NEVER CALLED!!!
Then I tried to catch all ouse messages in OnWndMsg and execute the following:
m_wndToolTip.RelayEvent(&msg);
with a msg I filled myself. This does not show a tool tip.
Thanks.
avivhal
|
|
|
|
|
i am working in vc++ paroject which is SDI interface now i want to convert it into MDI form(multiple dailog interface). what is the simplest way to do it on exixsting SDI project
auur_sunao
|
|
|
|
|
The easiest way would be to compare an empty SDI application with an empty MDI application. I know that OnInitInstance() will have a few differences. As far as the frame goes, CMDIFrameWnd will be used instead of CFrameWnd . The document will use CMultiDocTemplate instead of CSingleDocTemplate .
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
i am working on windows services as my semester project. can any body tell me plz, how to call an .exe or .dll file from a service.
one more thing that what event is triggered when system is locked. (when we press ctrl+alt+del) i have found a function from MSDN lockworkstation() but this is not gonna work. i want to launch an exe file when user is logged on or lock or unlock the system. looking forward for any good suggestion.
thank u.
Nadir Ali
Student Information Technology
National University of Sciences and Technology
Pakistan
|
|
|
|
|
Csharper99 wrote:
...how to call an .exe or .dll file from a service.
How about CreateProcess() ?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
If you only have to run on WindowsXP or later, you are in luck.
Your service, after registering its service control handler function, should receive a control event of SERVICE_CONTROL_SESSIONCHANGE. This will pass a data structure with the information about what happened: log on, log off, session locked, etc.
From MSDN:"A HandlerEx function is an application-defined callback function used with the RegisterServiceCtrlHandlerEx function. A service program can use it as the control handler function of a particular service.
The LPHANDLER_FUNCTION_EX type defines a pointer to this function. HandlerEx is a placeholder for the application-defined name.
This function supersedes the Handler control handler function used with the RegisterServiceCtrlHandler function. A service can use either control handler, but the new control handler supports user-defined context data and additional extended control codes."
Also see this:"WTSSESSION_NOTIFICATION
The WTSSESSION_NOTIFICATION structure provides information about the session change notification. A service receives this structure in its HandlerEx function in response to a session change event."
Ticking away the moments that make up a dull day, I friter and waster the hours in an offhand way...
|
|
|
|
|
I like to change an ItemMenuBitmap with the CMenu::SetMenuItemBitmaps() function.
I have problem to display the correct bitmap. Usually a dot bitmap is displayed ( may be is the default bitmap of MFC ).
Below is the used code.
CBitmap bitMap ;
bitMap .LoadBitmap(IDB_BITMAP);
pPopup->SetMenuItemBitmaps(ID_MENU_ITEM1,
MF_BYCOMMAND,&bitMap, &bitMap);
|
|
|
|
|
Dont declare bitMap variable local . If you declare it out of the function that you wrote this code it work safe .
I wrote this code and work very well :
CBitmap m_CheckBitmap,m_UnCheckBitmap;
OnButton1()
{
ASSERT(m_CheckBitmap.LoadBitmap(IDB_BITMAP1));
// Associate bitmaps with the "Test" menu item.
CMenu* mmenu = GetMenu();
CMenu* submenu = mmenu->GetSubMenu(0);
(submenu->SetMenuItemBitmaps(ID_A_B, MF_BYCOMMAND,
&m_CheckBitmap, &m_CheckBitmap));
}
|
|
|
|
|
I like to change an ItemMenuBitmap with the CMenu::SetMenuItemBitmaps() function.
I have problem to display the correct bitmap. Usually a dot bitmap is displayed ( may be is the default bitmap of MFC ).
Below is the used code.
CBitmap bitMap ;
breadthBitMap.LoadBitmap(IDB_BITMAP);
pPopup->SetMenuItemBitmaps(ID_MENU_ITEM1,
MF_BYCOMMAND,&bitMap, &bitMap);
|
|
|
|
|
hey, guys
As we know that a commonly used PDF file maybe contains both the vector elements and raster elements.
If I want to transfer all of vetor elements to raster then what will I do?
I think that some API functions is neccessary, so who can show me them.
thanks all
|
|
|
|
|
|
You have to use a RIP (raster image processor).. There are several around... some cheap, some expensive.. some freeware. Have a look for an application called GhostScript... that'll do what you wnat to do.
|
|
|
|
|
hello all
im connecting to a ODBC datasource and im using
hr = cpDbCMIS->Open("DSN=CP_CMIS_CON;UID=STUD_ADMIN;PWD=STUD_ADMIN","","",-1);
to connect to it, this works fine when i already know the user name and password
but i need to connect to different databases, with different user names and passwords
which would be provided by the users, and then stored in CString variables
i want to use something like
CString CnnStr="DSN=CP_CMIS_CON;UID="+username+";PWD="+password+"";
hr = cpDbCMIS->Open(CnnStr,"","",-1);
but i cant get that to work can ne1 help at all
thanks
simon
|
|
|
|
|
try
CString tmp="DSN=EOP;UID="+name+";PWD="+pw;
m_pDatabase->OpenEx(tmp, CDatabase::noOdbcDialog );
|
|
|
|
|
thanks but that doesnt work either
i dont use OpenEx
it is an ado connection if that helps
simon
|
|
|
|
|
si_69 wrote:
but i cant get that to work
Why? What is the value of CnnStr after the assignment? It should be the same as the first value you've shown being passed to Open() .
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
im a bit crap a c++
but if i use
CString CnnStr="DSN=CP_CMIS_CON;UID="+simon11+";PWD="+simon12+"";
hr = cpDbCMIS->Open(CnnStr,"","",-1);
then i get a complier error
error C2664: 'Connection15::Open' : cannot convert parameter 1 from 'CString' to '_bstr_t'
if i use GermanGeorge's example
CString tmp="DSN=CP_CMIS_CON;UID="+simon11+";PWD="+simon12;
cpDbCMIS->OpenEx(tmp, CDatabase::noOdbcDialog );
then i get the compiler error
error C2039: 'OpenEx' : is not a member of '_Connection'
|
|
|
|
|
How about:
hr = cpDbCMIS->Open(_bstr_t((LPCTSTR) CnnStr), "", "", -1);
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
superb, thanks
|
|
|
|