|
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!
|
|
|
|
|
Hi:
I'm beginner in activex programming with VC++ and i have a problem!
How can i create a multi-choice property for an activex control !!!!?
for example suppose an activex have a property with following features (through ClassWizard)
External Name : BorderStyle
Type : CString (for example)
Variable Name : m_borderStyle
Notification Function : OnBorderStyleChanged
Implementation : Member Variable (Radio Button)
and this property have some value such as (note that : more than three property !!! this is very important for me)
1) None
2) Flat
3) Static_Edge
4) Three_D
5) Button_Edge
6) Client_edge
and etc.
Now i want show this values in a drop-down list in the "ALL" Activex's property sheet and user select one of them
from it.
Please help me.
My english isn't very well, please excuse me for bad comments.
Thanks a lot.
|
|
|
|
|
I don't think you can directly....
Manually edit idl place something like:
typedef [uuid(8216ACE0-8C0F-40AF-AA1E-5E988573C582)]
enum {
[helpstring("1 - bsNone")] bsNone = 1,
[helpstring("2 - bsFlat")] bsFlat = 2,
[helpstring("3 - bsStatic_Edge")] bsStatic_Edge = 3,
.....
}BorderStylesConstants;
....
Change interface to look like...
[id(44444), propget] HRESULT SetStyle(BorderStylesConstants borderStyle);
|
|
|
|
|
Here is what I want to do
VB front end is main app
DLL # 1 creates an array of doubles
DLL # 2 performs some task on an array of doubles passed to it
Vb frontend will get a pointer to an array of doubles (double * array) from DLL #1 and pass the pointer to DLL #2 which accepts pointers to arrays of doubles.
How do I get VB to do this ie. recognize what a pointer to a array of doubles is??????
Thanks in advance for all help
|
|
|
|
|
Between dll's you can pass pointer like long value and inside the second dll you can assign this long to the real pointer and do the conversion
|
|
|
|
|
Thanks for the reply.
I thought about that but my ploblem is that the 2nd DLL(receiving the pointer) must have a (double*) as it's parameter. I can not redeclare the function to accept "void pointers". If I could, I would.
Any other suggestions?
|
|
|
|
|
Is it possible to add a hook to keyboard from a services
I want to add the hook when the service is starting and remove the hook when the service is stop.
I tried but the hook can not be installed.
Thanks
Florian
|
|
|
|
|
Yes you can, the only thing that you must consider is that a system wide keyboard hook must be placed inside a DLL.
Then you should create a DLL that contains the hook (the callback function) and remember that the service must have a mesage pump.
If you have more questions or if I have not been so clear, (or if I've completely missed the shot) don't mind to ask again.
Hope this helps...
|
|
|
|
|
Hi Everyone,
I have an application that is designed to load an image from the database. This image is in a compressed form like png, jpeg etc. I was wondering what is the process to loading the bitmap if it is already in memory (ie. not loading it from the disk)? Should I use something like FileMaps or something else?
Cheers,
Clint
|
|
|
|
|
there are a half-dozen articles on CP that handle image I/O. most of them can handle memory-based images. look in the "Bitmap and Palettes" section.
-c
Image tools: ThumbNailer, Bobber, TIFFAssembler
|
|
|
|
|
Hi Chris,
I did go through them, unfortunately they deal with their own classes. I would like to be able to use CImage (which supports decompressing png) from the MFC library. So what I need to know is how do I tell windows that this compressed png file is in memory and not on disk without having to save a temp file to disk?
Cheers,
Clint
|
|
|
|
|
i'm not familiar with CImage, but the MSDN says its Load method can take an IStream interface. so, you could hook up some kind of IStream-based COM object to read your memory-based image. (yeah, yuck)
-c
Image tools: ThumbNailer, Bobber, TIFFAssembler
|
|
|
|
|
How could I get the path of a APP.EXE ??
I need to open a Site with Internet Explorer browser. I have used the GetModuleFileName function, but I don't have the HMODULE parameter (to get HMODULE, the GetModuleHandle function also doesn't work).
Any idea ??
Thanks,
Cris.
|
|
|
|
|
|
Hello There!
If the app was put on your computer with an installer you don't need the path because it is registered in the registery automatically. You can just provide the name of the executable in ShellExecute(..) and it will launch the app.
However if you insist on getting the path use this:
char szRegBuf[200];
DWORD pcbData=199;
if(!::SHGetValue(HKEY_LOCAL_MACHINE,"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\TheExecutable.exe","Path",(LPDWORD)REG_NONE,szRegBuf,&pcbData))
{
AfxMessageBox("Successfuly located TheExecutable.exe path in the registry");
}
|
|
|
|
|
Ok, and abount the SHGetValue function ?? Where it is declared ??
[]'s
|
|
|
|
|
Hi Cris,
It is declared in Shlwapi.h.
Or you can use some other Registry access function if you want. I have the MSDN info for you if you wish. But once again you really don't need the path if you use ShellExecute(..) on an installed application.
Art
///////////////
From MSDN info
///////////////
SHGetValue
Retrieves a registry value.
DWORD SHGetValue(
HKEY hkey,
LPCTSTR pszSubKey,
LPCTSTR pszValue,
LPDWORD pdwType,
LPVOID pvData,
LPDWORD pcbData
);
Parameters
hkey
Handle to the currently open key, or any of the following predefined values: HKEY_CLASSES_ROOT
HKEY_CURRENT_CONFIG
HKEY_CURRENT_USER
HKEY_DYN_DATA (Windows 95 only)
HKEY_LOCAL_MACHINE
HKEY_PERFORMANCE_DATA (Windows NT only)
HKEY_USERS
pszSubKey
Address of a null-terminated string that specifies the name of the subkey from which to retrieve the value.
pszValue
Address of the value.
pdwType
Type of value. For more information, see Registry Data Types.
pvData
Address of the destination data buffer.
pcbData
Size of the destination data buffer.
Return Values
Returns ERROR_SUCCESS if successful, or a nonzero error code defined in Winerror.h otherwise. You can use the FormatMessage function with the FORMAT_MESSAGE_FROM_SYSTEM flag to retrieve a generic description of the error.
Remarks
Note If your application must set/retrieve a series of values in the same key, it is better to open the key once and set/retrieve the values with the regular Microsoft® Win32® registry functions rather than use this function repeatedly.
Requirements
Version 4.71 and later of Shlwapi.dll
Windows NT/2000: Requires Windows 2000 (or Windows NT 4.0 with Internet Explorer 4.0 or later).
Windows 95/98/Me: Requires Windows 98 (or Windows 95 with Internet Explorer 4.0 or later).
Header: Declared in Shlwapi.h.
Import Library: Shlwapi.lib.
|
|
|
|
|