|
On a small LAN, I must to send a Invoice number to another computer. I have tried to make a CSocket connection without good results.
I have writen a sequence als follow:
On the server: create, listen and accept (with debug, here stay still until the client send a connect message, I guess!!)
On the client: create, connect;
Then, I send on client with the send command, und the server is waiting with the receive command, but nothing comes in the *lBuf parameter.
The GetLastError show a 10022, that its something with Bind, but I have tried to put the bind command in different places (before the accept, after the accept, nothing works!!!!!!!)
And yes, I'm a newie!
|
|
|
|
|
I recommend Winsock Win32 API. We can help you if you ask a specific question.
Kuphryn
|
|
|
|
|
If I didnt decide I wanted serialization capabilities when I created the MFC app, then is it possible to change my mind later and add this feature. I saw that they put some info in step 4 advanced tab when creating the project, and it was the extension of the file that I want to associate woth my program. Since I didnt perform this step, could I fix matters by doing this association of the extension via Explorer? Or will I not be able to have serialization (projects too complex to recreate)
Appreciate your help,
ns
|
|
|
|
|
Serialization and extension association via file manager are two separate things.- You can add serialization to any app. See this[^] article for instructions.
- Associations via file manager are implemented by calling
CWinApp::RegisterShellFileTypes() which walks thru the list of your CDocTemplate s and for each template, adds registry entries that Windows maintains for file associations. /ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Wow! The articles look really interesting. Hopefully better than this book I'm reading about it. I'll be baaaack with questions from your series...........many thanks for the link.
|
|
|
|
|
Hi All,
I'm trying to set up tool tips on a CFormView derived view, and I am having a little bit of trouble. I've defined the following in my view class:
// In the message map
ON_NOTIFY_EX(TTN_NEEDTEXT, 0, OnToolTipNotify)
// Implementation of handler:
// Supply tool tip text when asked by Windows
BOOL CMyView::OnToolTipNotify(UINT id, NMHDR * pNMHDR, LRESULT * pResult)
{
TOOLTIPTEXT *pTTT = (TOOLTIPTEXT *)pNMHDR;
UINT nID =pNMHDR->idFrom;
TRACE("\nTTN_NEEDTEXT, idFrom = %i", nID);
if(pTTT->uFlags & TTF_IDISHWND)
{
// idFrom is actually the HWND of the tool
nID = ::GetDlgCtrlID((HWND)nID);
if(nID)
{
pTTT->lpszText = "Test";
pTTT->hinst = AfxGetResourceHandle();
return(TRUE);
}
}
// Otherwise, what?
TRACE("nHmm . . . ");
return(FALSE);
}
I am getting the HWND's for the static labels on the form, and am able to supply tooltip text for these. However, I have some ActiveX controls (afncy edit boxes), which don't have the ID_ISHWND flag set, and the ID in te NMHDR is not the ID of the control, or anything else I can tell.
Anybody have any ideas how to figure out which control sent the tooltip notification?
Thanks
|
|
|
|
|
Why is
if(NULL != pView->m_list1.GetSafeHwnd())
not a good test of whether the m_list1 has "materialized" ? If I use this function in my OnInitialUpdate(), will m_list1 be existing at that point (its a control on the CFormView). Where in OnititalUpdate() can you be sure that the controls been generated? Again, does the code above presuppose that m_list1 exists?
I had thought that it would return NULL if m_list1 hadnt yet been created, but in actuality it crashes (the control in this case is being accessed from the mainframe class, and the view its on hasnt been spawned yet. I'm confused because I always thought GetSafeHwnd() was a good test to see if the control was valid yet....
Appreciate your help,
ns
|
|
|
|
|
Your code is probably crashing NOT because of the call to GetSafeHwnd(), but rather the attempt to access the pView pointer, which is most likely invalid at the point this code is being executed. To be sure, change it to this:
if( pView != NULL )
{
if( pView->m_list1.GetSafeHwnd() )
{
}
}
It might help if you could explain a little about why you're trying to access the list control (on your FormView) from the mainframe class before the view is even spawned. Is this some initialization code?
Ty
"The significant problems we face cannot be solved at the same level of thinking we were at when we created them." -Albert Einstein
|
|
|
|
|
I just wanted to reset the view2 from view1 (clear out its controls). So if view2 is already spawned, things are good, but when view2 isnt even yet created --- I wasnt handling that correctly. The menu item doing this reset is handled by mainframe.....hope this explains my motivation...
Appreciate your help,
ns
|
|
|
|
|
From an object oriented perspective, it's not a good idea to expose the view's members. Instead, the view should expose a public method like InitMyListCtrl() which can be called by the mainframe.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I know...I'm terrible. Everything is public in my stuff so I dont have to do Get and Set functions. So lazy.
BTW, I looked at your articles and got diverted to the ClassFactory link. Ugh. I have gotten away with no clue about a Factory (until now). I shall have to dive into this exotic sounding stuff now...
Its getting cold here - in the 70s....brrr. I already have the heat on.
Appreciate your help,
ns
|
|
|
|
|
ns wrote:
Its getting cold here - in the 70s....brrr. I already have the heat on.
It's still a toasty 30F at night in Mass - I can't wait for winter to arrive. I love the cold! But then, I'm spoiled by a heated garage at home and work.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Please could someone help me?
I have a SQL command which retrieves records no problem.
I can do wildcard searches with every field except my date field. What am I doing wrong?
Can someone give me some ideas or sample code.
Thankyou very much!
|
|
|
|
|
Hi. Well, I've made a few assumptions in my answer.
1) you're running SQL server
2) You're trying to run a Like against your Date field.
3) Your date field is of type DateTime
Well, the docuementation for Like says
Syntax
match_expression [ NOT ] LIKE pattern [ ESCAPE escape_character ]
Arguments
match_expression
Is any valid SQL Server expression of character string data type.
...
So, the date needs to be converted to a string before you run the like on it. You can use the CONVERT function to do that.
E.g.
--CONVERT ( data_type [ ( length ) ] , expression [ , style ] )
select CONVERT(varchar, DateField, 103 ), DateField From SourceTable
The 103 you see there is the style or datetime you want to convert to. E.g.
From MSDN
0 or 100 Default mon dd yyyy hh:miAM (or PM)
1 or 101 USA mm/dd/yy
2 or 102 ANSI yy.mm.dd
3 or 103 British/French dd/mm/yy
4 or 104 German dd.mm.yy
5 or 105 Italian dd-mm-yy
6 or 106 - dd mon yy
7 or 107 - Mon dd, yy
8 or 108 - hh:mm:ss
9 or 109 (*) Default + milliseconds mon dd yyyy hh:mi:ss:mmmAM (or PM)
10 or 110 USA mm-dd-yy
11 or 111 JAPAN yy/mm/dd
12 or 112 ISO yymmdd
13 or 113 (*) Europe default + milliseconds dd mon yyyy hh:mm:ss:mmm(24h)
14 or 114 - hh:mi:ss:mmm(24h)
20 or 120 (*) ODBC canonical yyyy-mm-dd hh:mi:ss(24h)
21 or 121 (*) ODBC canonical (with milliseconds) yyyy-mm-dd hh:mi:ss.mmm(24h)
126(***) ISO8601 yyyy-mm-dd Thh:mm:ss:mmm(no spaces)
130* Kuwaiti dd mon yyyy hh:mi:ss:mmmAM
131* Kuwaiti dd/mm/yy hh:mi:ss:mmmAM
* The default values (style 0 or 100, 9 or 109, 13 or 113, 20 or 120, and 21 or 121) always return the century (yyyy).
** Input when converting to datetime; output when converting to character data.
*** Designed for XML use. For conversion from datetime or smalldatetime to character data, the output format is as described in the table. For conversion from float, money, or smallmoney to character data, the output is equivalent to style 2. For conversion from real to character data, the output is equivalent to style 1.
I suggest using 121 "yyyy-mm-dd hh:mi:ss.mmm" as you can get everything back.
Then run like as you want.
E.g.
select DateFieldFrom SourceTable
Where CONVERT ( varchar , DateField, 121 ) like '2002-11-05 [0-1][0-4]%'
I hope this solves you problem.
Pete
Insert Sig. Here!
|
|
|
|
|
Please don't cross post, it simply wastes peoples time. Your identical question in the SQL forum is answered.
Signature space for rent. Apply by email to....
|
|
|
|
|
I think you should add this character before and after your string: '#'
|
|
|
|
|
Hi,
I want to develop a small vc++ SDI application to read .bsc File.
Any help in this direction is highly appreciated. Some where in MSDN there is one sample which does this. I am unable to find it as i donot have MSDN with me now. Any pointers?
Thanks
cutti
|
|
|
|
|
Hi all. I've got a sockets communication module with is used in our app.
Its works fine, but apparently it doesn't like proxy server.
Coule anyone point me to an example of what to modify in a normal sockets connection to make it use the proxy instead.
Thanks everyone.
Pete
Insert Sig. Here!
|
|
|
|
|
You can have a look at this[^]
and
this[^]
If it's not a SOCKS proxy, your end user will need a proxy client installed (provided by the one that made the proxy)
lazy isn't my middle name.. its my first.. people just keep calling me Mel cause that's what they put on my drivers license. - Mel Feik
|
|
|
|
|
Thanks for that Daniel.
I did do a search for sockets and proxy but didn't come across those.
Cheers
Pete
Insert Sig. Here!
|
|
|
|
|
Would anyone know how to print a Dialog box. I want to the whole thing printed. I have tried loading it into a dc but I might not be doing it properly to print it in the created printer dc. I need help fast...Thank you
|
|
|
|
|
Have you looked into the WM_PRINT[^] message?
Wenn ist das Nunstück git und Slotermeyer? Ja! Beierhund das oder die Flipperwaldt gersput!
|
|
|
|
|
see keyboard, if u press key "Print Screen SysRq", u can copy (print) the dialog image to somewhere u want.
if by programming, there is an example in MSDN (i can't remember its name, possible in sdk).
basically, use screen dc (no WM_PAINT at all).
includeh10
|
|
|
|
|
Maybe this will help you:
http://codeproject.com/printing/printing_wo_docview.asp[^]
Mazy
"And the carpet needs a haircut, and the spotlight looks like a prison break
And the telephone's out of cigarettes, and the balcony is on the make
And the piano has been drinking, the piano has been drinking...not me...not me-Tom Waits
|
|
|
|
|
Would anyone know how to print a Dialog box. I want to the whole thing printed. I have tried loading it into a dc but I might not be doing it properly to print it in the created printer dc. I need help fast...Thank you
|
|
|
|