|
Richard White wrote:
I use it return value ,there is a cmpile error:
And which one? In which code?
Please rephrase your question, so that one can understand what you want to ask.
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
Are you getting a compiler error, or a runtime error? You indicate a "cmpile error" but give no other information.
ERROR_ACCESS_DENIED and ERROR_MORE_DATA are defined in winerror.h.
|
|
|
|
|
this question how u posted it cant be answered!
try again!
Don't try it, just do it!
|
|
|
|
|
I am sorry for my poor english,thank for your help,I search MSDN,can't find NERR_SUCCESS and ERROR_ACCESS_DENIED defined.
I use like this :
if (NetUserEnum(.....) == NERR_Success )<br />
..........
The compiler complain as following.
C:\MYAPP\VCAPP\GetUser\GetUserDlg.cpp(111) : error C2065: 'NERR_Success' : undeclared identifier
|
|
|
|
|
Richard White wrote:
I use like this: if (NetUserEnum(.....) == NERR_Success )
..........
The compiler complains[...]
Sure, because the name of the constant is NERR_SUCCESS .
See the difference? Character case does matter!
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
Hi All,
I'm implementing a CFileDialog open/save as application using 6.0.
My problem is trying to prevent the user from browsing above a specific directory, but allow them to browse the directories below it.
I've tried many different approaches, but I still can't get it to work. At the moment I'm capturing the OnFolderChange message, which is produced after the user changes the folder he/she is browsing. In that method, I'm checking the current directory, and if it is outside of my directory range, then I thought I could just set the current working directory to what I need it to be, and then force the application to redraw. Here's the code:
<br />
void CLibselformdlg::OnFolderChange() <br />
{<br />
char buffer[MAX_PATH]="";<br />
DWORD tmp;<br />
::GetCurrentDirectory(MAX_PATH,buffer);<br />
tmp = ::GetLastError();<br />
IUXLogData("are you ready\n",TRACE1);<br />
if (strstr(buffer,"C:\\iux\\data") == NULL){<br />
::SetCurrentDirectory("\\iux\\data");<br />
tmp = ::GetLastError();<br />
this->Invalidate();<br />
}<br />
}<br />
The SetCurrentDirectory I don't think works. The getlasterror returns a 183 after this function is run. You can see the different ways I've been trying to force the window to redraw with the new directory, but I'm not having any luck.
Any Suggestions?
Thanks alot!
Dan
|
|
|
|
|
You need to look at hook functions for common dialogs, specifically handling CDN_FOLDERCHANGE and/or CDN_SELCHANGE.
Steve S
|
|
|
|
|
Steve S wrote:
You need to look at hook functions for common dialogs, specifically handling CDN_FOLDERCHANGE and/or CDN_SELCHANGE.
Yup, been there done that.
|
|
|
|
|
While I can't say for sure since I don't know the entire situation, it seems a better approach would be to set permissions at the OS level. That way, CFileDialog does not have to do anything special. It only "goes" where the user has permission to.
|
|
|
|
|
That's an interesting idea. One that I like. But the people upstairs seem to want to go against what windows does with every other application so I'm stuck trying to limit directory access at this open/save as level.
Any other ideas? Other than creating an open/save as dialog from scratch which IMO makes no sense at all to re-invent the wheel
Thanks guys! I appreciate it!
Dan
|
|
|
|
|
will1383 wrote:
...which IMO makes no sense at all to re-invent the wheel.
They don't seem to mind so why should you? Let it be known (to the powers that be) that such a solution is non-standard and prone to problems.
I worked on a project once where it was decided that a dialog's "X" button and the Cancel button would each do different things. If the dialog was actually doing something, rather than just accepting input from the user, it had both Close and Cancel buttons. I hate it when goofy standards are put in place, only to propagate through the annals of the projects. Changing them requires an act of Congress.
|
|
|
|
|
So far so good in porting our code from 6.0 to .net2003. I have done a small part of this so far and most of the problems can be easly corrected. But, one item that I'm not having any success with is a define that is used in one of our files. The PR_EMS_AB_PROXY_ADDRESSES is defined in the EMSABTAG.H file in <VC 6 Install Dir>\VC98\Include. The problem is that .net2003 does not use the same file.
After looking up this define in the MSDN library, I see that is is now part of the Exchage Server SDK. I cannot find any downloads from the MSDN site (guess M$ wants $$ for this SDK!) so the problem can be fixed.
Does anyone out there who has ported from 6.0 to .net or someone developing with the .net using this define? If so, what do I need to use to get this to compile and keep the functionality?
Thank You In Advance
Larry J. Siddens
Cornerstone Communications
TAME THE DOCUMENT MONSTER
www.unifier.biz
|
|
|
|
|
Check out Microsoft Platform SDK.
http://www.microsoft.com/msdownload/platformsdk/sdkupdate/
Kuphryn
|
|
|
|
|
Can someone direct me to a good tutorial/ description as to how to use Excel in a VC++ app . I need to basically write to an excel file but use the Excel API .
|
|
|
|
|
Obviously, you will need to use OLE to accomplish this. I can't really give you alot of information other than check out MSDN or look on code project for OLE interfaces.
Hopefully that will help. Sorry I can't help more. I haven't done any of this in a while, and I used perl when I did.
Good Luck!
|
|
|
|
|
First you'll need to import from Excel's type library. After that, use the classes that are provided. Here a small snippet that gets two values from the user, plugs them into two cells and puts their sum into a third:
_Application app;
Workbooks books;
_Workbook book;
Worksheets sheets;
_Worksheet sheet;
Range range;
COleVariant vtOptional((long) DISP_E_PARAMNOTFOUND, VT_ERROR),
vtTrue((short) TRUE),
vtFalse((short) FALSE);
CString strText;
if (app.CreateDispatch("Excel.Application") == TRUE)
{
app.SetVisible(TRUE);
books = app.GetWorkbooks();
book = books.Add(vtOptional);
sheets = book.GetSheets();
sheet = sheets.GetItem(COleVariant((short) 1));
range = sheet.GetRange(COleVariant("A1"), COleVariant("A1"));
m_ebCellA1.GetWindowText(strText);
range.SetValue(COleVariant(strText));
range = sheet.GetRange(COleVariant("A2"), COleVariant("A2"));
m_ebCellA2.GetWindowText(strText);
range.SetValue(COleVariant(strText));
range = sheet.GetRange(COleVariant("A4"), COleVariant("A4"));
range.SetFormula(COleVariant("=A1 + A2"));
}
|
|
|
|
|
David - you'll think I'm following you around the newsgroups...but it proves I've searched before asking the question....
Is the Excel API documented. I've got about as far as I can from the tutorials, ie opening a worksheet, updating cells, saving etc. I want to be able to move cells, pivot tables, cut'n'paste, insert formulaes, basically automate Excel from my app.
Cheers
Angel
************************************************************
The sooner you fall behind, the longer you have to catch up.
|
|
|
|
|
Angel1058 wrote:
Is the Excel API documented.
Not to my knowledge. I use trial and error, looking through the .h file, and using VB. Those three together can usually tell me how a particular method works.
"Opinions are neither right nor wrong. I cannot change your opinion of me. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
Thanks all for the time taken (again!). I managed to get this far cribbing code from here and there. I am virtually there in what I want to do - it's very basic...
A1 : D4 - a 4x4 grid. I can update any value no problem. When all cells are populated, I need to drop the first column, and move the remaining 3 columns along. The VBA for this is...
Range("B1:D4").Select<br />
Range("B1:D4").Cut Desitination:=Range("A1:C4")<br />
Range("A1:C4").Select
My interpretation (using the API) is
lpDisp = sheet.GetRange(COleVariant("B1") , COleVariant("D4")<br />
range.AttachDispatch(lpDisp);<br />
range.Select();<br />
range.Cut(COleVariant("A1:C4"));
and I get 'Cut method of Range class failed'.
Any chance of you spoon feeding me this last bit please?
Cheers
*********************************************
The sooner you fall behind, the longer you have to catch up.
|
|
|
|
|
Hi,
This has been troublign me fors oem time now.
I have an MFC Application which is Dialog-Based. My 'main' is constructed of initializations and a 'DoModal()' for my dialog, this is AppWizard generated code.
My problem is that my application (or rather dialog window) :
1. fails to respond to the 'Start+M' key-combination (minimize all)
2. when clicking the 'Show Desktop' icon in the quick-launch bar my application disappears, but re-appears when any OTHER application is restored.
3. fails to minimize when clicking it's entry in the task-bar (it dose maximize if it was previously minimized.
I've tried looking at CFrameWnd's implementation for help, but can't find the specifics on this one.
Can someone help ?
Thanks very much
Ohad
|
|
|
|
|
ohadp wrote:
1. fails to respond to the 'Start+M' key-combination (minimize all)
The dialog will need the WS_MINIMIZEBOX style.
|
|
|
|
|
thanks very much.
This solved all my problems. and I thought it was something much more complicated
|
|
|
|
|
Hi,
I have a program that sends messages over the internet. I now need to change it so that i can save the messages to a file. Can someone tell me how to read from a file, open a file, and save to a file?
In my app, all my windows come up from drop down menus. So where should I open the file ?(once I know how) In the main class or the class where all the messages are made?
thanks
Jimmy
Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)
|
|
|
|
|
http://www.codeproject.com/script/comments/forums.asp?msg=593820&forumid=1647#xx593820xx
You'll probably want to create a CStdioFile object if this is going to be a text file. Otherwise, if the messages belong to the document, take advantage of serialization. Most everything is already in place so it's fairly painless.
|
|
|
|
|
Hi,
Can you explain a little more for me? What do you mean that the messages belong to the document? What is serialization?
Did I do something wrong by asking the question yesterday and today? is that why you put the link to my question yesterday? If so, sorry.
Jimmy
Just cause I am 15, doesn't mean I'm dumb! (I'll really be 4 on Feb. 29...the year 2004)
|
|
|
|