|
I have an application with its doc, wiew, main classes and I added an ATL component (a dual interface). Now I want to call a Fire process in CProxy class from whichever this classes (doc, view..) or whatever I declare, how can I do it? Thanks
|
|
|
|
|
|
I've problem to enumerate local network shares when i'm not currently connected to LAN. I use standard Windows Networking functions - WNetOpenEnum to open enumeration from root -> enumerate whole current branch with WNetEnumResource & store container resources in list(no recursion) -> open remaining containers from list w/ WNetOpenEnum and repeat enumeration until list is empty or other error.
When my comp is connected to a network, all works perfectly. When not, none of shared resources is found although Windows Explorer or Windows Commander shows them. What i'm doing wrong ? Is there some source code that solves this problem or some good faq describing in depth windows networking ?
Thanks in advice for help
J. Forman
Config: Windows98, TCP/IP network protocol, client for MS Networks, MS family logon
|
|
|
|
|
My guess is that you should first detect whether or not you are actually connected to the LAN. Then if your not connected call WNetOpenEnum passing it RESOURCE_REMEMBERED as the scope.
Just a theory thought, I've never actually tried it.
-Ben
---------
On the topic of code with no error handling -- It's not poor coding, it's "optimistic"
|
|
|
|
|
Hi ,
i was just trying to use CArray template and ooops it gave hundreds of errors.When i get rid of it it compiles.an anybody help me to fix it
OK.
what i added :
I have a person class in another file.
and the code to create CArray is:
CArray<cperson,cperson&> m_PersonArray;
what is the wrog with it?should i include some header files,
just give this beginner a hint
with greetings
Özgür
Bachelor of Control&Computer Engineering from IStanbul Technical University
Worked with Delphi for 6 Months
Worked with Java for 3 Months
Now ,Working with MFC,VIsual C++6.0 and ADO
|
|
|
|
|
Hi,
You need to #include <afxtempl.h> probably in stdafx.h for ease.
Also you will need a copy constructor and operator= for your class
yourclass(const yourclass& c)
yourclasss& operator=(const yourclass& rhs)
HTH
Bob.
|
|
|
|
|
oops, the name of the header you need is <afxtempl.h>
|
|
|
|
|
darn this thing, it's... afxtempl.h
|
|
|
|
|
Assuming that the class is called person you can do two things:
One: This is how to create a CArray of 'person's
CArray<person, person> m_PersonArray
Two: you can ditch CArray for the dog it is and use STL
Oh, use an ampersand (shift 7) and lt or gt for the < or > signs, or otherwise all you'll do is lose everything inbetween them, as it's parsed as a HTML tag.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
I think you should declare its as :
CArray <int, int=""> m_IntArray for integers and
CArray <cperson, cperson=""> m_PersArray for an array of CPerson structure or class
|
|
|
|
|
On a window i can't go on drawing pictures or lines with pen and brush
memory leak comes when number of graphical components on the screen increases
is there any possible solution to this ?
though the memory for an application is alloted by system itself, how can we use it efficiently as in this case ?
parag
|
|
|
|
|
By making sure you don't leak memory. When you select a pen or brush into a DC, a CPen* or CBrush * is returned and must be caught/selected back before the DC is deleted.
CPen* pOld = DC.SelectObject(&myPen);
//draw some stuff
DC.SelectObject(pOld); // Now the memory leak is taken care of.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
I have a Dialog Box "AAA" which consists of a command button ( let's say "DISPLAY" ).
On clicking this button another dialog box "BBB" is displayed which consists of a CListctrl among others.
Now, I wanted to catch a notification when ever the item is changed.
So, I implemented the
OnNotify (LVN_ITEMCHANGED,IDC_LISTCTRL, FnHandler) like this :
void CClass :: OnItemCHanged(NMHDR* pNMHDR, LRESULT* pResult )
{
NM_LISTVIEW* pNMListView = ( NM_LISTVIEW)pNMHDR;
int len = 0;
LPTSTR str;
myListCtrl.GetItemText(pNMListView ->iItem, 2, str, len)
*pResult = 0;
}
Now, Coming to my doubt, when i try to debug with the break point inside this function, I observe that it breaks when I click the button DISPLAY. why's this when I haven't changed the state of the item yet, also, the application crashes saying "User BreakPoint Exception" after teh GetItemText call. I do see an error saying that " HEAP ALLOCATION EXCEEDED".
what's wrong in the whole issue.
PL. explain.
regards
Sankar
|
|
|
|
|
Your bug is that you don't allocate any space to hold the text. You pass an uninitialized pointer (str). And you give the buffer length as 0.
--Mike--
http://home.inreach.com/mdunn/
#include "buffy_sig"
|
|
|
|
|
when i try to debug with the break point inside this function, I observe that it breaks when I click the button DISPLAY.
LVN_ITEMCHANGED gets sent whenever any property of an item changes, including when an item is added/deleted to/from the list. If you want to act only when the selection changes, compare the old and new states of the item (which are sent with the message) and act only if their LVIS_SELECTED bits are opposite.
--Mike--
http://home.inreach.com/mdunn/
#include "buffy_sig"
|
|
|
|
|
Hi
I serialized my data in an xml file but how can I open or save them using
Document view architecture.I want to read data from document and use it in view.
I will be glad if I get a clear answer.
Thanks
Pathi Gorantla
bhikshapathi_g@semanticspace.com
|
|
|
|
|
You have to override CDocument::OnOpenDocument and CDocument::OnSaveDocument. Do not call base class implementaion - just open your own file and read/write.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Yeah I am trying to override OnOpenDocument() but i cant get the data from file into the document.I declared DISPPARAMS pointer in document and trying to get the data read from file into this pointer but getting an error.my aim is to read from file and show it in view.
my code is
void componentView::fileOpen()
{
isFileOpen=true;
CFileDialog file(true,
NULL, NULL,
OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT,
NULL, GetParent());
file.DoModal();
CString filep=file.GetPathName();
BSTR filepath;
TCHAR szStringRepresentation[200];
wsprintf ( szStringRepresentation, _T("%s"), filep );
filepath=_bstr_t(szStringRepresentation) ;
CClientDC cdc(this);
CPen penStroke(PS_SOLID, 1, RGB(0,0,0));
cdc.SelectObject(&penStroke);
parse pa;
DISPPARAMS var=pa.readFile(filepath);
DISPPARAMS *params;
params=&var;
VARIANT myVars[2];
VariantInit(&myVars [0]);
myVars[0].vt=VT_ARRAY|VT_I4;
myVars[0]=params->rgvarg[0];
VariantInit(&myVars [1]);
myVars[1].vt=VT_ARRAY|VT_I4;
myVars[1]=params->rgvarg[1];
SAFEARRAY* SXArray;
SAFEARRAY* SYArray;
SXArray=myVars[0].parray;
SYArray=myVars[1].parray;
long lxbound,lybound;
long uxbound,uybound;
SafeArrayGetLBound(SXArray,1,&lxbound);
SafeArrayGetUBound(SXArray,1,&uxbound);
SafeArrayGetLBound(SYArray,1,&lybound);
SafeArrayGetUBound(SYArray,1,&uybound);
VARIANT ptVar;
VariantInit(&ptVar);
ptVar.vt=VT_BSTR;
int i,j,k,l;
for(long p=lxbound;p<=uxbound;p++)
{
SafeArrayGetElement(SXArray,&p,(&ptVar.bstrVal));
i=strtol(_bstr_t(ptVar.bstrVal),NULL,10);
SafeArrayGetElement(SYArray,&p,(&ptVar.bstrVal));
k=strtol(_bstr_t(ptVar.bstrVal),NULL,10);
p++;
SafeArrayGetElement(SXArray,&p,(&ptVar.bstrVal));
j=strtol(_bstr_t(ptVar.bstrVal),NULL,10);
SafeArrayGetElement(SYArray,&p,(&ptVar.bstrVal));
l=strtol(_bstr_t(ptVar.bstrVal),NULL,10);
cdc.MoveTo(i,k);
cdc.LineTo(j,l);
}
}
I did in view but how can I read file in document and draw the lines in view?
bhikshapathi_g@semanticspace.com
|
|
|
|
|
> I did in view but how can I read file in document and
> draw the lines in view?
You should read the file in OnOpenDocument and store the data in your document class. Use this data in overrided OnDraw in view class and draw whatever you want.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Hi!!!
I need to send a keysrtoke to another application. There is no problem if I simply send a key (for example F2). The problem appears if I want to send a key combination like Ctrl+F2
Prease, help me!!!
SOS!!!
Thank you for your attention.
|
|
|
|
|
You're gonna want to look up SendInput API function... Basically build an array of INPUT strcutures with (using virtual key codes) control down, f2 down, f2 up, control up. Then BlockInput (TRUE), stick that array into SendInput and fire it off, then BlockInput (FALSE).
It should work semi decent in NT/2k, but in 98, things get sh*tty if your INPUT array contains more than 75 fields... Still haven't gotten around that... Good luck
--
Peace,
Amit Jain
|
|
|
|
|
I am writing a payroll software...I am having problem in print preview..... I can print preview if use 17 inch monitor but if i use the 14 inch monitor all the text are miss placed...
Why????
okie
|
|
|
|
|
Because you're printing to too big a size. Your 14 " monitor no doubt is running at a lower resolution than your 17 ".
Are you printing relative to the size of your printed page ? Are you working out how big the page is ?
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Even when I change the resolution the same thing happens....I already check the page setting its A4 size.....
okie
|
|
|
|
|
Wait a minute - no matter what the screen resolution, the page doesn't fit on a 14" monitor and it does on a 17" monitor ? I think it's time for some details, like the resolutions you've used, some code, etc.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|