|
Thank you thank you, I thought I was going crazy.
Oh wait, don't reply to that last comment;P
If I only had all of the MFC functions memorized then maybe I wouldn't be so dependant on MS search technology, rather lack of it
Later, JoeSox www.joeswammi.com It's not easy facin' up when your whole world is black Rolling Stones
|
|
|
|
|
According to MSDN:
Every process that loads the DLL maps it into its virtual address space. After the process loads the DLL into its virtual address, it can call the exported DLL functions.
Suppose a process starts and at some stage it dynamically loads a dll. A second process also load the same dll. Now what actually happened ??? Do each of these processes share the same chunk of memory where dll is loaded or dll code is loaded at two different locations for both of these processes ???
|
|
|
|
|
Yes, the two processes share the same chunk of memory.
~ Vimal
|
|
|
|
|
Vimal Earnest wrote:
Yes, the two processes share the same chunk of memory.
Suppose the function exposed by the dll has some static variable. Now what happens in this case...whether both applications that are using this dll share single copy of variable ???
|
|
|
|
|
What happens is, the COW (Copy On Write) mechanism is used by the system to make a private copy of these variables. To be specific, the system makes a private copy of the memory section containing static and global variables in the process modifying these variables.
refer chapter 19 (DLL basics) of Jeffrey Richter's Programming Applications for Microsoft Windows 4th ED for more info.
~ Vimal
|
|
|
|
|
dear all,
i have a menu for controlling from 0 - 100%, total 11 steps (11 items in menu)...
if i use individual message handler for each item, there are 11 functions... but, their difference is just the control value.
so, anyone have any idea to multiple handle menu items with single handler function?
thanks,
jim
|
|
|
|
|
Use ON_COMMAND_RANGE in the message map.
rechi
|
|
|
|
|
I've learnt earlier that we just have to check "Group" property of the first radio button to group the subsequent radio buttons under it. However after some time, i decided to add another 2 radio buttons on the dialog box. Visually, it's just below the previous radio buttons.However i don't know how to place them under the previous group of radion buttons....
can anyone help?
thanks
|
|
|
|
|
The radio buttons that are in a "group" need to be consecutive in the tab order. WHen you're in the dialog editor, press Ctrl-D to edit the tab order.
--Mike--
THERE IS NO THERE IS NO BUT THERE IS
MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT
Homepage | RightClick-Encrypt | 1ClickPicGrabber
If privacy is outlawed, only outlaws will have privates.
|
|
|
|
|
You can write into the *.rc file so that your radio control are consecutive.
to open it, just right click on it and select open with...
you choose Source Code (text) Editor
Everything's beautiful if you look at it long enough...
|
|
|
|
|
I’m trying to attach a Word doc to my application so I can modify it.
Here is my code so far:
IUnknown *p = NULL;
CLSID clsid;
IClassFactory *pClf = NULL;
CoInitialize(NULL);
CLSIDFromProgID(L"Word.Document.8", &clsid);
HRESULT hr = CoCreateInstance(clsid, NULL, CLSCTX_ALL, clsid, (void **)&p);
When I run the code, hr gets the following error: -2147467262
Any help would be greatly appreciated.
Thanks,
Ken
|
|
|
|
|
If you type hr,hr in the watch window, you can see what the error is, in text.
This might help
Also try to type @EAX,hr in the watch window, then you can always see the last returned HRESULT
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
Thanks for your response,
The error is "No such interface supported" and I don't know why?
Thanks again,
Ken
|
|
|
|
|
Because you are passing the CLSID again where you should be passing the IID of the interface you want - IID_IDispatch .
--Mike--
THERE IS NO THERE IS NO BUT THERE IS
MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT
Homepage | RightClick-Encrypt | 1ClickPicGrabber
If privacy is outlawed, only outlaws will have privates.
|
|
|
|
|
Anders Molin wrote:
Also try to type @EAX,hr in the watch window, then you can always see the last returned HRESULT
Nice.!!
Hush,hush...
thought I heard you call my name now.
Kula Shaker.
Amit Dey
Latest articles at CP - PocketPC New menu
Office addin
|
|
|
|
|
Hello all,
I'm using a CListView class in report mode,in my splitter window.When I'm trying to insert items, I see that although I can add the first item data, I cannot see other items(i.e. I can see Hello and the World column, but no entry under it. Help??
//Precreate window -
//cs.style |= LVS_REPORT|LVS_SORTASCENDING; //set list styles
//then
InsertColumn(0,IDS_HELLO);
InsertColumn(1,IDS_WORLD);
CString szHello("Hello");
CString szWorld("World");
CListCtrl& list = GetListCtrl();
ZeroMemory((void*) &Item, sizeof(Item));
Item.mask = LVIF_TEXT;
Item.iItem = 0;
Item.iSubItem = 0;
Item.pszText = (LPTSTR)(LPCTSTR)szSubject;
list.InsertItem(&Item);
list.SetItemText(0,1,(LPTSTR)(LPCTSTR)szWorld);
Hush,hush...
thought I heard you call my name now.
Kula Shaker.
Amit Dey
Latest articles at CP - PocketPC New menu
Office addin
|
|
|
|
|
Turn off the sort style, does it work then? If so, then the item you insert isn't ending up at index 0 because of sorting. You need to save the return value from InsertItem() which is the index that the item is actually inserted at, and use that index in the SetItemText() call.
--Mike--
THERE IS NO THERE IS NO BUT THERE IS
MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT
Homepage | RightClick-Encrypt | 1ClickPicGrabber
If privacy is outlawed, only outlaws will have privates.
|
|
|
|
|
No, Mike, that did not solve it. I took another llok at the MFC rowlist sample, and it only works when I first enter the first item for all rows via InsertItem(), and then do SetItemText() for subitems. But no matter what I do, I can never make 'real' per row basis item insertion...ie an InsertItem() followed by SetItemText() for sub items before moving on to the next row.??
I have tried both CListCtrl::xxxx as well as ListView_xxx functions, but nothing works.
Hush,hush...
thought I heard you call my name now.
Kula Shaker.
Amit Dey
Latest articles at CP - PocketPC New menu
Office addin
|
|
|
|
|
I'm working with this third party SDK, which consists of a dll some headerfiles and a couple of lib files.
The SDK is written in VC6.
If I use it from a normal MFC application I have no problems.
From an ATL exe, no problems.
From an ATL dll, bang! Unresolved externals. There is something strange going on that makes the linker go kinda crazy
Any ideas?
Maybe I should add that the SDK is written in C++, not C. It uses classes as parameters in functions
[edit]
Here is the errors from the linker
MPDOKManager.obj : error LNK2001: unresolved external symbol "char const * const dok::szSDKVersion" (?szSDKVersion@dok@@3PBDB)
MPDOKManager.obj : error LNK2001: unresolved external symbol "public: virtual __thiscall CObserver::~CObserver(void)" (??1CObserver@@UAE@XZ)
MPDOKManager.obj : error LNK2019: unresolved external symbol "protected: __thiscall CObserver::CObserver(void)" (??0CObserver@@IAE@XZ) referenced in function "protected: __thiscall dok::CDOK::CDOK(class dok::CDOK const &)" (??0CDOK@dok@@IAE@ABV01@@Z)
Debug/test.dll : fatal error LNK1120: 3 unresolved externals
[/edit]
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
How do you create a connection to a shared network printer and set it as default. I love C, but need to create logon "scripts" without the script. No VBS, please!
|
|
|
|
|
>How do you create a connection to a shared network printer
Umm, U can try to map it... WNetAddConnectionX, NetUse*
>and set it as default.
Let me guess: SetPrinter?
Brian
|
|
|
|
|
Does any one have any idea if GDI+ or the XP OS extends the size of a DIB in the GDI to better then 32K ?
Thanks in advance
Tony Teveris
tteveris@gspinc.com
Gerber Scientific Products
Senior Software Engineer
Phone: 860 648 8151
Fax: 860 648 8214
83 Gerber Road West
South Windsor, CT 06074
|
|
|
|
|
I've got my declaration of canal tree which has a static array of ID's of icons. I then derive another tree control class from canal tree called RPhysicalTree. I then derive andother class from RPhysicalTree called SacmanSetUpTree. When I compile, I keep getting a linker error. I've delcared and defined the array correctly. What's up?
--------------------Configuration: SacmanSetupProgram - Win32 Debug--------------------
Compiling...
RCanalTree.cpp
d:\data\vss\coderesearch\sacmansetupprogram\debug\msado15.tlh(409) : warning C4146: unary minus operator applied to unsigned type, result still unsigned
Generating Code...
Skipping... (no relevant changes detected)
rphysicaltree.cpp
RSacmanSetupTree.cpp
Linking...
rphysicaltree.obj : error LNK2005: "public: static int * RCanalTree::m_icons" (?m_icons@RCanalTree@@2PAHA) already defined in RCanalTree.obj
RSacmanSetupTree.obj : error LNK2005: "public: static int * RCanalTree::m_icons" (?m_icons@RCanalTree@@2PAHA) already defined in RCanalTree.obj
Debug/SacmanSetupProgram.exe : fatal error LNK1169: one or more multiply defined symbols found
Error executing link.exe.
SacmanSetupProgram.exe - 3 error(s), 1 warning(s)
#if !defined(AFX_RCANALTREE_H__18E8CD78_FD89_45EE_B60E_E483A7A4520A__INCLUDED_)<br />
#define AFX_RCANALTREE_H__18E8CD78_FD89_45EE_B60E_E483A7A4520A__INCLUDED_<br />
<br />
#if _MSC_VER > 1000<br />
#pragma once<br />
#endif // _MSC_VER > 1000<br />
#include "resource.h"<br />
#include "CanalManager.h"<br />
<br />
enum EnumTreeItems { TI_NONE,TI_SYSTEM,TI_SEGMENT,TI_SITE,TI_CANAL,TI_TURNOUT,<br />
TI_PUMP,TI_WELL,TI_ORDER_FOR_PUMP,TI_ORDER_FOR_TURNOUT,TI_ORDER_FOR_WELL,<br />
TI_AUTOMATIC_CONTROL,TI_CENTRAL_CONTROL,TI_CENTRAL_FLOW,TI_LOCAL_FLOW,<br />
TI_LOCAL_LEVEL,TI_MANUAL_CONTROL,TI_CONTROLLERS,TI_SSFC,TI_MC_SITE,<br />
TI_CV_SITE,TI_LLC_SITE,TI_LFC_SITE,TI_SCHEDULING};<br />
<br />
enum EnumForOnCheck { CHECK_OKAY, CHECK_IGNORED, CHECK_REPOPULATE };<br />
<br />
<br />
class RCanalTree : public CTreeCtrl<br />
{<br />
public:<br />
RCanalTree(CCanalManager *pCanMan=NULL);<br />
<br />
public:<br />
const CCanalManager* GetCanalManagerPointer() { return m_pCanMan; }<br />
void SetCanalManagerPointer(CCanalManager *pCanMan) { m_pCanMan=pCanMan; }<br />
<br />
public:<br />
virtual void Populate();<br />
int DeleteChildren(HTREEITEM hParent);<br />
static int m_icons[];<br />
HTREEITEM GetDepthNextItem(HTREEITEM hItem);<br />
HTREEITEM FindItem(const char *name, int dwData);<br />
HTREEITEM InsertChildItem(const char *name, int dImage, HTREEITEM hParent, DWORD data, int iCheck=-1, bool bCondition=true);<br />
<br />
<br />
public:<br />
int GetIconIndex(int idOfIcon);<br />
int GetImageIndexFor(int idOfIcon);<br />
bool DeleteChildItem(HTREEITEM hParent, const char* name, DWORD data);<br />
virtual void UpdateImages();<br />
virtual EnumForOnCheck OnCheck(HTREEITEM hItem, bool bNowChecked);<br />
virtual ~RCanalTree();<br />
<br />
protected:<br />
bool IsScheduleLocked();<br />
CCanalManager* m_pCanMan;<br />
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);<br />
<br />
DECLARE_MESSAGE_MAP()<br />
};<br />
<br />
<br />
int RCanalTree::m_icons[] = { <br />
IDI_ICON_SYSTEM, <br />
IDI_ICON_CANAL, <br />
IDI_ICON_SITE, <br />
IDI_ICON_WELL, <br />
IDI_ICON_TURNOUT, <br />
IDI_ICON_PUMP, <br />
0
};<br />
<br />
<br />
<br />
<br />
#endif // !defined(AFX_RCANALTREE_H__18E8CD78_FD89_45EE_B60E_E483A7A4520A__INCLUDED_)
|
|
|
|
|
Move the definition of the array to a CPP file. The way it is currently, one m_icons array is defined for every CPP file that includes that header, which leads to the linker error
--Mike--
THERE IS NO THERE IS NO BUT THERE IS
MAGIC PIXIE DUST BUSINESS GENIE CODE PROJECT
Homepage | RightClick-Encrypt | 1ClickPicGrabber
"Which comes first, the bug or the stress?" -- Chris Maunder
|
|
|
|
|
I thought I had tried that, many times. Oh well, thanks dooood!
|
|
|
|
|