|
BOOL CAMIDoc::MountNetworkDrive()<br />
{<br />
CString sDrive;<br />
<br />
BeginWaitCursor();<br />
while (TRUE)<br />
{<br />
if( (_access( "\\\\apps1\\data", 0 )) == -1 )<br />
{<br />
CDriveMountDlg dlg;
int response = dlg.DoModal();<br />
if (response == IDCANCEL)<br />
return FALSE;<br />
<br />
NETRESOURCE resource;<br />
resource.dwType = RESOURCETYPE_ANY;<br />
resource.lpRemoteName = "\\\\apps1\\data";<br />
resource.lpProvider = NULL;<br />
<br />
int nDrive = 4;<br />
<br />
sDrive.Format("%c:", nDrive + 'A');<br />
resource.lpLocalName = sDrive.GetBuffer(2);<br />
<br />
DWORD result = WNetAddConnection2(&resource, (LPCSTR)dlg.m_sPassword, NULL, 0);<br />
if (result == ERROR_INVALID_PASSWORD)<br />
{<br />
AfxMessageBox("Invalid password. Aborting");<br />
return FALSE;<br />
}<br />
<br />
while ((result != 0) && (nDrive < 25))<br />
{<br />
nDrive++;<br />
sDrive.Format("%c:", nDrive + 'A');<br />
result = WNetAddConnection2(&resource, (LPCSTR)dlg.m_sPassword, NULL, 0);<br />
}<br />
<br />
if (result != 0)<br />
{<br />
AfxMessageBox("Unable to mount a drive. Please check password and ensure you have a free drive letter. Aborting.");<br />
}<br />
else<br />
{<br />
m_sDrive = sDrive;<br />
m_bMountFlag = TRUE;<br />
break;<br />
}<br />
}<br />
else<br />
break;<br />
}<br />
<br />
EndWaitCursor();<br />
return TRUE;<br />
}<br />
<br />
BOOL CAMIDoc::DismountNetworkDrive()<br />
{<br />
if (m_bMountFlag)<br />
{<br />
DWORD result = WNetCancelConnection2(m_sDrive, 0, TRUE);<br />
if (result != NO_ERROR)<br />
{<br />
result = GetLastError();<br />
if (result == ERROR_BAD_PROFILE)<br />
{<br />
m_bMountFlag = FALSE;<br />
}<br />
else if (result == ERROR_CANNOT_OPEN_PROFILE)<br />
{<br />
m_bMountFlag = FALSE;<br />
}<br />
else if (result == ERROR_DEVICE_IN_USE)<br />
{<br />
m_bMountFlag = FALSE;<br />
}<br />
else if (result == ERROR_EXTENDED_ERROR)<br />
{<br />
m_bMountFlag = FALSE;<br />
}<br />
else if (result == ERROR_NOT_CONNECTED)<br />
{<br />
m_bMountFlag = FALSE;<br />
}<br />
else if (result == ERROR_OPEN_FILES)<br />
{<br />
m_bMountFlag = FALSE;<br />
}<br />
return FALSE;<br />
}<br />
}<br />
return TRUE;<br />
<br />
}
|
|
|
|
|
I've got a CStatic with more text than gets into the window, and would like to make the text scroll programmatically. CEdit s do have LineScroll which do precisely what I want, but alas this method is not available for static controls. Does anyone know some custom-made routine or anything to achieve this behavior? The thing can be replicated with CWnd::SCrollWindow and all that stuff, but details are clumsy and maybe someone has already done the work
Thanx
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Is read-only edit control an option?
Tomasz Sowinski -- http://www.shooltz.com
To some its a six-pack, to me it's a support group
|
|
|
|
|
It's almost an option, but notentirely: this way, the cursor appears, and I don't like any cursors around. Also, disabling the edit control gets me almost there, but the text is grayed and I want it black (do you know how to change this?).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaquín M López Muñoz wrote:
this way, the cursor appears, and I don't like any cursors around
You mean the insertion point cursor, right? So maybe handling WM_SETCURSOR will get rid of this problem?
Tomasz Sowinski -- http://www.shooltz.com
To some its a six-pack, to me it's a support group
|
|
|
|
|
I tried, and it doesn't seem to work (the docs says one should return TRUE from the parent to stop further processing to the childs). Anyway, I guess this has to do with the mouse rather than the text cursor.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaquín M López Muñoz wrote:
the docs says one should return TRUE from the parent to stop further processing to the c
So you handled WM_SETCURSOR in parent right? Maybe you should add handler in edit clas, do not call base class implementation and just set cursor to standard arrow instead?
Tomasz Sowinski -- http://www.shooltz.com
To some its a six-pack, to me it's a support group
|
|
|
|
|
Have just tried it, returning TRUE and FALSE --nothing. I guess this message has nothing to do with text cursors, but rather it is suposed to handle mouse icons and stuff.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Wait - what do you mean by 'text cursor'? A caret? This blinking | thing? In this case, you'd have to probably handle WM_SETFOCUS (or EN_SETFOCUS) and call HideCaret.
Tomasz Sowinski -- http://www.shooltz.com
To some its a six-pack, to me it's a support group
|
|
|
|
|
Yes, I refer to the | blinking thing. I've finally found a solution: it doesn't involve handling those messages, but rather cheating the system with the enabling/disabling thing by handling WM_ENABLE . I found this trick here[^].
Thank you very much for your efforts. Keep the good work helping people here at CP!
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I'm not to sure there is a way to do this easily, Basically within my OnWizNext I validate data, if this fails, I want to drop out of the wizard process for the user to modify data. I was hoping to be able to call OnCancel() however this doesnt work, has anyone any ideas?
|
|
|
|
|
Popup a messagebox, tell some data error and return without call base class
overload function "OnWizNext"
I am seeking...
For what?
Why did you ask me for what? I don't know!
|
|
|
|
|
Hi all,
I am using msado15.dll in my application by #import directive
as follows
#import "msado15.dll"\
no_namespace rename("EOF", "EndOfFile")
while compiling i am getting the following warning
"\debug\msado15.tlh(405) : warning C4146: unary minus operator applied to unsigned type, result still unsigned"
can any one explain me why this warning hapens and what is the solution.
Thanks in advance
anju
|
|
|
|
|
This is an MS bug, Q253317. It can safely be ignored, as I have been doing so for years. The quickest way to avoid seeing it is to change your import statement to the following:
#pragma warning( push )
#pragma warning( disable: 4146 )
#import "c:\program files\common files\system\ado\MSADO15.DLL" no_namespace rename( "EOF", "EndOfFile" )
#pragma warning(pop)
</code>
HTH-
Ty
|
|
|
|
|
Hi TyMatthews,
Thanks a lot now code is working fine.
anju
|
|
|
|
|
I'm using _ftime64(__timeb64) to obtain the system time. but when compiling, I receive "unknown identifier"-errors.
include files (found on msdn):
#include "time.h"
#include "sys/types.h"
#include "sys/timeb.h"
code (found on msdn):
struct __timeb64 timebuffer;
char *timeline;
_ftime64( &timebuffer );
timeline = _ctime64( & ( timebuffer.time ) );
Have I forgotten an include file?
Is there a better way?
tnx
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
Grote Smurf (aka frisco) wrote:
Is there a better way?
I'm not sure it's actually a better way, but you need VC.NET for ctime64. If you prefer to use VC6, then ctime (without 64) is your only choice.
Tomasz Sowinski -- http://www.shooltz.com
To some its a six-pack, to me it's a support group
|
|
|
|
|
I don't have .NET, so ctime it is.
one more thing:
The msdn-doc says this about ftime: All versions of the C run-time libraries.
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
Bluute tette!
|
|
|
|
|
Grote Smurf (aka frisco) wrote:
The msdn-doc says this about ftime: All versions of the C run-time libraries.
What's wrong with that?
Tomasz Sowinski -- http://www.shooltz.com
To some its a six-pack, to me it's a support group
|
|
|
|
|
You can read it as: All versions of the C run-time libraries, including vc6 run-time.
[VISUAL STUDIO 6.0] [MFC] [WIN98/2]
|
|
|
|
|
Isn't that correct information? They refer to 64-free version.
Tomasz Sowinski -- http://www.shooltz.com
To some its a six-pack, to me it's a support group
|
|
|
|
|
Try this - from my CSimpleDate class here on CP:
<br />
{<br />
long time_val ;<br />
struct tm *tm_ptr ;<br />
<br />
time( (time_t *)&time_val) ;<br />
tm_ptr = localtime( (time_t *)&time_val) ;<br />
<br />
m_Hour=tm_ptr->tm_hour;<br />
m_Min=tm_ptr->tm_min;<br />
m_Second=tm_ptr->tm_sec;<br />
if(m_Hour >= 12)<br />
{<br />
m_bPM=TRUE;<br />
m_Hour-=12;<br />
}<br />
else<br />
m_bPM=FALSE;<br />
}<br />
We are called the nation of inventors. And we are. We could still claim that title and wear its loftiest honors if we had stopped with the first thing we ever invented, which was human liberty.
Mark Twain- Foreign Critics speech, 1890
|
|
|
|
|
So, where do you guys get your icons for your application?
You go to msdn and get them over there?
You have an in-house artists who creates them?
You downloaded a nice collection of the internet? url?
Or you just open an executable and take the icons from there. If so, what program can you use to extract that nifty looking 256-color bitmap icons out of an executable.
And finally, are the icons I take from eg. shell32.dll royalty free?
My graphic ability is a bit on the low side
Thanks in advance
Wim
|
|
|
|
|
We create them mostly in-house.
Wim Jans wrote:
what program can you use to extract that nifty looking 256-color bitmap icons out of an executable
You can use Visual Studio. In file open dialog, select "Resources" in Open as combobox.
Pavel
Sonork 100.15206
|
|
|
|
|
Its amazing how much good icons can improve your application.
I used to spend ages making, what in the end turned out to be pretty crap, icons.
check out www.glyfx.com, they have a free version of the typical icons available with VC++ but you can pay them for more advanced icons.
or if you feel adventurous try out
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnwxp/html/winxpicons.asp
Asim Hussain
e: asim@jawache.net
w: www.jawache.net
|
|
|
|