|
How do you convert a piece of DirectX SDK coding to an ActiveX Control? I tried to convert a piece of program(DirectX SDK coding) to an ActiveX, the source code compiled successfully, but when i tried to use the ActiveX control it gives a message "FAILED TO CREATE THE COMPONENT". I couldnt debug the code. Help me to Solve the problem.
Make the POSSIBLE, HAPPEN - immasara
|
|
|
|
|
I'd like to save a list of files into a certain directory. I used Spy++ and saw that apps use SysTreeView32. Ok, but searching for it in .NET I found nothing. Then I searched for it on Google and found that it's actually a combination of CTreeView and CTreeCtrl. Yet even with that, I don't know how to add all the directories in the system.
|
|
|
|
|
if you are working on MFC try this link..
http://rossm.net/Electronics/Computers/Software/C++/MFC.htm#DTree
maybe you can get some help..
cheers
Himanshu
|
|
|
|
|
Can anyone Help
I am having problems adding a filter to my STL List the problem is in the function
AddFilter.
The char string FilterName is not being added correctly in the statement mfilter.push_back(FilterName);
by replacing the variable FilterName for literals there is no problem.
When debuging the previus is always the current FilterName it appears the reference the same location.
The code below shows what i have implemented please take a look and let me know where I mest up.
Any Help would be appreciated
Thanks
//----------------------------------------------------------------------------
// Mesage handler for Filter box.
//----------------------------------------------------------------------------
LRESULT CALLBACK Filter(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
{
int wmId, wmEvent;
HWND hwndList;
int iSel;
int cIndex;
int success;
switch (message)
{
case WM_INITDIALOG:
hwndList = GetDlgItem(hDlg, IDC_FILTERLIST);
if(nFilters > 0)
{
char tmp[MAX_FILTER_LENGTH];
for(FilterIterator = mfilter.begin();
FilterIterator != mfilter.end();
FilterIterator++)
{
strcpy(tmp, *FilterIterator);
iSel = (INT)SendMessage(hwndList, LB_ADDSTRING, 0, (LPARAM)tmp);
SendMessage(hwndList, IDC_FILTERLIST, iSel, (LPARAM)tmp);
}
}
break;
case WM_COMMAND:
wmId = LOWORD(wParam);
wmEvent = HIWORD(wParam);
success = FALSE;
switch (wmId)
{
case IDOK:
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
break;
case IDCANCEL:
EndDialog(hDlg, LOWORD(wParam));
return TRUE;
break;
case IDC_ADD_STRING:
char tmpfilter[MAX_FILTER_LENGTH];
GetDlgItemText(hDlg, IDC_NEWFILTER, (LPTSTR)tmpfilter, strlen(tmpfilter));
success = AddFilter(tmpfilter);
if (success == TRUE)
{
hwndList = GetDlgItem(hDlg, IDC_FILTERLIST);
iSel = (INT)SendMessage(hwndList, LB_ADDSTRING, 0, (LPARAM)tmpfilter);
SendMessage(hwndList, IDC_FILTERLIST, iSel, (LPARAM)tmpfilter);
SetDlgItemText(hDlg, IDC_NEWFILTER, "");
}
break;
case IDC_FILTERLIST:
if (wmEvent == LBN_DBLCLK)
{
MessageBox(hDlg, "ListBox", "LISTBOX", MB_OK);
hwndList = GetDlgItem(hDlg, IDC_FILTERLIST);
cIndex = SendMessage(hwndList, LB_GETCURSEL, 0, 0);
FilterIterator = mfilter.begin();
advance(FilterIterator, cIndex);
mfilter.remove(*FilterIterator);
SendMessage(hwndList, LB_DELETESTRING, cIndex, 0);
}
break;
}
}
return FALSE;
}
//----------------------------------------------------------------------------
// Function AddFilter
//----------------------------------------------------------------------------
BOOL AddFilter(char* FilterName)
{
bool RetCode;
// abort if too many filters
if( nFilters >= MAX_FILTERS )
{
RetCode = FALSE;
}
else
{
int fSize = strlen(FilterName);
if( fSize >= 1)
{
// This is the code which fails
mfilter.push_back(FilterName);
// This section proves the data is written to the list and is diplayed correctly when the
//filter dialog is opened calling Filter(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
if(nFilters == 0)
mfilter.push_back("One");
else if(nFilters == 1)
mfilter.push_back("Two");
else if(nFilters == 2)
mfilter.push_back("Three");
else
mfilter.push_back("Else");
//
nFilters++;
RetCode = TRUE;
}
}
return RetCode;
}
|
|
|
|
|
Are you storing raw pointers in the list? It looks like you're storing pointers instead of full copies of the strings. This would explain your problem and also explain why using statically declared strings works.
I suggest you store a string class in your list. Preferably one that is reference counted, if you're doing things like sorting the list (VC++ _bstr_t class is ref counted).
E.g.
std::list<String> mfilter
|
|
|
|
|
Thanks I will look for info on the _bstr_t class, this is what I want to acheive.
I have declared the list :-
typedef list<char*> FILTERLIST;
I simply require a list capable of allowing addition and deletion of strings no sorting is required. The dialog box allows the user add and remove strings from the list. The strings in the list then used with the strstr() function one I had problems using cstring with strstr() and other variables such as static char buf[MAX_LINE_LENGTH];
// test filter option
if(prefs.filter && nFilters > 0)
{
bool found = FALSE;
int Loop = 0;
while(Loop < nFilters && found == FALSE)
{
char tmp[MAX_FILTER_LENGTH];
FilterIterator = mfilter.begin();
advance(FilterIterator, Loop);
strcpy(tmp, *FilterIterator);
if(FALSE != strstr(buf, tmp))
found = TRUE;
Loop++;
}
// display message if filter not found
if(found == FALSE)
update = AddLine( i, buf );
}
else
{
// display message
update = AddLine( i, buf );
}
|
|
|
|
|
In my MFC dialog program, I have a dialog box with a CRichEditCtrl on it using the dialog editor. I want to dynamically create a CRichEditCtrl just like that, but it's not looking quite right:
static (using dialog editor): http://igx89.digitalrice.com/good.jpg[^]
static code:
CONTROL "",IDC_EDIT1,"RichEdit20A",ES_MULTILINE | ES_AUTOVSCROLL | <br />
ES_READONLY | NOT WS_VISIBLE | WS_BORDER | WS_VSCROLL | <br />
WS_TABSTOP,7,18,303,238<br />
dynamic: http://igx89.digitalrice.com/bad.jpg[^]
Dynamic code:
ChatList->Create(ES_MULTILINE | ES_READONLY | WS_VISIBLE | WS_BORDER | WS_VSCROLL | WS_TABSTOP,rect,this,WM_USER+600);<br />
What am I doing wrong? I tried using GetStyle() to get the style directly from the static control and put it in the dynamic, but then the control didn't have a border!
|
|
|
|
|
I want to replace it by one of my own
|
|
|
|
|
The simplest way to do this is to disable the built-in scrollbar on the list box, and then place your own adjacent to the list box. I'm not sure if even using ownerdraw you could actually replace the built-in scrollbar.
Software Zen: delete this;
|
|
|
|
|
I've thought that too, but if i do, i'll have to map the mouse and key events by my own, i only want to replace the classic scroolbar by one of my own, withou mapping the events, is there another way?
|
|
|
|
|
Not that I know of (and I looked hard). I ran into this very problem on an application that used a touch screen. It turns out the builtin scrollbar didn't resize in a way that was appropriate for the touch screen, so I ended up building my own. I could have used the so-called 'flat scrollbars' provided by some versions of Internet Explorer, but they're not a good idea (they're no longer supported under IE6+).
Software Zen: delete this;
|
|
|
|
|
At the moment I'm trying to create my own automation plugin for Photoshop. My specs: Windows 2000, Photoshop 7.0, Photoshop SDK v6.0.
The docs for the SDK are below average, especially for the info on the Action File Format, located in the doc "Photoshop File Formats.pdf" p70. I;m trying to understand the Alias structure that is placed into every photoshop action file. It makes mention of handle, FSSpec, and a windows full path. Being on a windows based pc i suspected the alias data within the action file would simply be a full path string to be read in but unfortunately the path is surrounded with rubish data that i suspect is Macintosh information.
My question is when i read in the alias structure from an action file how exactly do I parse it to create an alias property within a newly created descriptor? Or, simply what is the FSSpec format so that i can make sense of the surround rubish.
Thanks for any tips.
|
|
|
|
|
hello,
i would like know how to attribuate a time to one variabl who i declared and this time i can mesure it,but with second,for exemple i would that this variabl have time equal to 05 econd.
|
|
|
|
|
I did not get what you need exactly..
please give an example
|
|
|
|
|
if i want that the application terminate in 5 second how to attribuat this time to the variable (and it's true if i want to attribuat 10 minutsà).
how to attribuate seconde or minute or hours?
think you
|
|
|
|
|
Hello,
I'm using a CTreeCtrl, which is processing the notify message TVN_GETINFOTIP to display an InfoTip. The tip displays a multiline description of the item in the tree, and that is working just fine. However, the InfoTip goes away on its own after a few seconds, which is often not long enough for the user to read its entire contents.
Is there a way I can increase the duration of the InfoTip, so it stays displayed longer, or until the user moves the mouse away?
Would it be a better idea for me to use a ToolTip control instead?
thanks
srs
|
|
|
|
|
I use Zafir Anjum's TitleTip[^] class to provide an infinitely displayed tooltip in my TakeStock[^] app. I use it to display a stock quote tooltip when the window is too narrow to display the entire quote.
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
If I recall correctly, there was a special type of "message box" that contained a static control, a single edit control and two push butten - OK and Cancel. This box could be used to get a single text string from the user - basically it was a "convience", thus saving the programmer from having to create a whole dialog box just to get a single text string from the user. Does anybody remember what it was called and what the MFC or API call was to access this box? I searched both the forums on this website as well as MSDN documentation and turned up nothing.
Thanks
|
|
|
|
|
Wasn't that a VB thing?
|
|
|
|
|
That may be where I remember it from - in Visual Basic. I'll have to go see if I can dig up the source code of a toy program I created under VC++ a few years ago when I was writting a program to access SCSI devices at the low (sector) level. It was a program that allowed me to enter a sector number and it read that sector from a SCSI device and displayed it in a HEX/ASCII dump, like you typically see in hex editors. I remember using a simple dialog to get the sector number, but I cannot remember if it was something built into the MFC or something I made up using the dialog editor and the CDialog class. I think I just passed in a string for the text to be displayed in the dialog, i.e. "Enter Sector number to read", and if the OK button was pressed, it returned a string containing the text entered in the text field or NULL if cancel was pressed.
Oh well, if this turnes out to be a dead-end, it is nothing for me to whip togther a quick dialog using the dialog editor and CDialog class to create the necessary dialog box - just hoping that there was a "convience" feature available in the library.
|
|
|
|
|
|
Thanks! That's what that was - InputBox, but as was mentioned, it is a VB thing. I was going to make up my own and submit it to this site, but looks like someone already has .
I guess I ought to sign up for an account on here. This website is turning out to be a real nice resource for Windows developers (this is my first real project under Windows, just about everything I did before was under Unix, so Windows development is still relatively new to me).
Thanks for the help
|
|
|
|
|
I'm looking for a 3rd alternative to my problem, here is the situation (using VC++ 6 ):
I will be creating a ton of similar looking dialogs for my application ( same pattern ), each dialog is build with other child dialogs components ( like building blocks ), each needs to be different; each child dialog is independant and is responsible for itself.
I first started using the resource editor and created each dialog, and placing static controls as placeholder, and creating the different child dialogs in each dialog that I created, using the place holders to place the child dialogs.
pros : easy, simple ...
cons : can't use the child dialog directly in the parent dialog, in the resource editor when designing each dialog.
Then, I was asked to see if I can make it easier to the other programmers, so, instead of using the resource editors, I simply create each child dialog, and move them by hand.
pros : not much work is needed in the resource editor, everything is code.
cons : limitation on the flexibility of the parent's dialog layout.
I think the best solution could be to use somekind of custom ActiveX control. What is the best way/place to start looking for info on this (besides here ) ?
Can an ActiveX control be designed to have other MFC controls inside itself ?
Will there be something new and better for VC 7 ?
Thanks.
Max.
|
|
|
|
|
|
Yummy!
I will look into this thing this weekend.
Thanks.
Max.
|
|
|
|
|