|
I used Search operation within *.h files supplied with Visual Studio, for "SP_DEVICE_INTERFACE_DATA" string. Thus I found the SetupAPI.h file and then I analyzed it.
|
|
|
|
|
nope... still didn't work.
I've also made sure that the setupapi.lib is also part of the options for the linker and that I've provided a path to the lib files in the project properties.
Kitty5
|
|
|
|
|
Today it was reported a similar problem with other header files.
The solution was to put your #include after "stdafx.h":
#include "stdafx.h"
#include <windows.h>
#include <stdlib.h>
#include <objbase.h>
#include <setupapi.h>
#include <winioctl.h>
#include <process.h>
#include <memory.h>
If it works, you can move your #include to the end of "stdafx.h" file and then rebuild the solution. In this case, next time your file will be compiled faster.
-- modified at 11:57 Friday 16th June, 2006
|
|
|
|
|
Hi
XlTable Structure has 255 as the max length for a string block
so if I want to send a unicode text I'm restricted with 127 max
and the worst is that when an application like Excel expect to have
- lets say 200 - chars each block then we can't send unicode text
so any Idea how can I send unicode using XlTable
-if any one knows other format except tdtString that do the job -
regards
BASSEL
|
|
|
|
|
Hey there,
I'm building a gui that has multiple tabs, and what I had done was set the hwnd variables as static variables such as below:
<br />
BOOL CALLBACK OptionsDialogProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)<br />
{<br />
<br />
static HWND* tab1_hwnd = new HWND;<br />
static HWND* tab2_hwnd = new HWND;<br />
static HWND* tab3_hwnd = new HWND;<br />
static HWND* tab4_hwnd = new HWND;<br />
static HWND* tab5_hwnd = new HWND;<br />
static HWND* tab6_hwnd = new HWND;<br />
static HWND* CurrentTabHwnd = new HWND;<br />
static int* CurrentTabIndex = new int;<br />
static HWND* hwndTab = new HWND;<br />
<br />
switch(msg)<br />
{<br />
case WM_INITDIALOG:<br />
{<br />
<br />
LPSTR tab1_title = "General";<br />
LPSTR tab2_title = "Player Edit";<br />
LPSTR tab3_title = "Stats Attributes";<br />
LPSTR tab4_title = "Stats Format";<br />
LPSTR tab5_title = "File Upload";<br />
LPSTR tab6_title = "Advanced";<br />
<br />
<br />
INITCOMMONCONTROLSEX tabctl;<br />
<br />
tabctl.dwSize = sizeof(tabctl);<br />
tabctl.dwICC = ICC_TAB_CLASSES;<br />
<br />
InitCommonControlsEx(&tabctl);<br />
<br />
*hwndTab = GetDlgItem(hwnd,IDC_TAB1);<br />
<br />
TCITEM ItemStruct;<br />
<br />
ItemStruct.mask = TCIF_TEXT;<br />
ItemStruct.pszText = tab1_title;<br />
ItemStruct.cchTextMax = sizeof(tab1_title);<br />
ItemStruct.iImage = 0;<br />
ItemStruct.lParam = 0;<br />
<br />
SendMessage(*hwndTab, TCM_INSERTITEM, 0, (LPARAM)&ItemStruct);<br />
<br />
ItemStruct.pszText = tab2_title;<br />
ItemStruct.cchTextMax = sizeof(tab2_title);<br />
<br />
SendMessage(*hwndTab, TCM_INSERTITEM, 1, (LPARAM)&ItemStruct);<br />
<br />
ItemStruct.pszText = tab3_title;<br />
ItemStruct.cchTextMax = sizeof(tab2_title);<br />
<br />
SendMessage(*hwndTab, TCM_INSERTITEM, 2, (LPARAM)&ItemStruct);<br />
<br />
ItemStruct.pszText = tab4_title;<br />
ItemStruct.cchTextMax = sizeof(tab2_title);<br />
<br />
SendMessage(*hwndTab, TCM_INSERTITEM, 3, (LPARAM)&ItemStruct);<br />
<br />
ItemStruct.pszText = tab5_title;<br />
ItemStruct.cchTextMax = sizeof(tab2_title);<br />
<br />
SendMessage(*hwndTab, TCM_INSERTITEM, 4, (LPARAM)&ItemStruct);<br />
<br />
ItemStruct.pszText = tab6_title;<br />
ItemStruct.cchTextMax = sizeof(tab2_title);<br />
<br />
SendMessage(*hwndTab, TCM_INSERTITEM, 5, (LPARAM)&ItemStruct);<br />
<br />
*tab1_hwnd = CreateDialogParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_OPTIONS_GENERAL), *hwndTab, General_OptionsDialogProc, 0);<br />
*tab2_hwnd = CreateDialogParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_OPTIONS_PLAYEREDIT), *hwndTab, PlayerEdit_OptionsDialogProc, 0);<br />
*tab3_hwnd = CreateDialogParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_OPTIONS_STATSATTR), *hwndTab, StatsAttr_OptionsDialogProc, 0);<br />
*tab4_hwnd = CreateDialogParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_OPTIONS_STATSFORMAT), *hwndTab, StatsFormat_OptionsDialogProc, 0);<br />
*tab5_hwnd = CreateDialogParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_OPTIONS_FILEUPLOAD), *hwndTab, FileUpload_OptionsDialogProc, 0);<br />
*tab6_hwnd = CreateDialogParam(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_OPTIONS_ADVANCED), *hwndTab, Advanced_OptionsDialogProc, 0);<br />
<br />
*CurrentTabIndex = 0;<br />
*CurrentTabHwnd = *tab1_hwnd;<br />
<br />
ShowWindow(*tab1_hwnd,SW_SHOWDEFAULT);<br />
<br />
<br />
}<br />
break;<br />
<br />
case WM_NOTIFY:<br />
{<br />
<br />
LPNMHDR lpnmhdr = (LPNMHDR) lParam; <br />
<br />
switch(lpnmhdr->code){<br />
case TCN_SELCHANGE:<br />
{<br />
ShowWindow(*CurrentTabHwnd, SW_HIDE);<br />
<br />
switch(TabCtrl_GetCurSel(*hwndTab)){<br />
case 0:<br />
ShowWindow(*tab1_hwnd,SW_SHOWDEFAULT);<br />
*CurrentTabHwnd = *tab1_hwnd;<br />
*CurrentTabIndex = 0;<br />
break;<br />
case 1:<br />
ShowWindow(*tab2_hwnd,SW_SHOWDEFAULT);<br />
*CurrentTabHwnd = *tab2_hwnd;<br />
*CurrentTabIndex = 1;<br />
break;<br />
case 2:<br />
ShowWindow(*tab3_hwnd,SW_SHOWDEFAULT);<br />
*CurrentTabHwnd = *tab3_hwnd;<br />
*CurrentTabIndex = 2;<br />
break;<br />
case 3:<br />
ShowWindow(*tab4_hwnd,SW_SHOWDEFAULT);<br />
*CurrentTabHwnd = *tab4_hwnd;<br />
*CurrentTabIndex = 3;<br />
break;<br />
case 4:<br />
ShowWindow(*tab5_hwnd,SW_SHOWDEFAULT);<br />
*CurrentTabHwnd = *tab5_hwnd;<br />
*CurrentTabIndex = 4;<br />
break;<br />
case 5:<br />
ShowWindow(*tab6_hwnd,SW_SHOWDEFAULT);<br />
*CurrentTabHwnd = *tab6_hwnd;<br />
*CurrentTabIndex = 5;<br />
break;<br />
<br />
}<br />
}<br />
break;<br />
default:<br />
return FALSE; <br />
}<br />
<br />
}<br />
break;<br />
case WM_COMMAND:<br />
{<br />
<br />
switch(LOWORD(wParam)){<br />
<br />
case IDOK:<br />
SendMessage(hwnd, WM_CLOSE, 0, 0);<br />
break;<br />
case IDCANCEL:<br />
SendMessage(hwnd, WM_CLOSE, 0, 0);<br />
break;<br />
}<br />
<br />
}<br />
break;<br />
case WM_CLOSE:<br />
{<br />
<br />
EndDialog(hwnd, 0);<br />
delete tab1_hwnd;<br />
delete tab2_hwnd;<br />
delete tab3_hwnd;<br />
delete tab4_hwnd;<br />
delete tab5_hwnd;<br />
delete tab6_hwnd;<br />
delete CurrentTabHwnd;<br />
delete CurrentTabIndex;<br />
delete hwndTab;<br />
<br />
}<br />
<br />
break;<br />
<br />
default:<br />
return FALSE;<br />
}<br />
return 0;<br />
}<br />
As you can also see I have dynamically allocated them as well. The reason for doing this is because I dont want to make sure that the dialog boxes dont hog a lot of memory. The problem I am receiving is that once this dialog box is called that contains the multiple tabs, I get an error once I close, reopen and close once again this specific dialog box. The error is as follows:
Debug Assertion Failed!
Program: C:/.../RS_Stats32.exe
File: dbgdel.cpp
Line: 47
Expression: _BLOCK_TYPE_IS_VALID(pHead->nBlockUse)
I looked on MSDN but it doesnt offer any helpful advice on how I fix this error. I know its an issue with dynamically allocating those variables because I did not receive this error when the variables were just static and not dynamically allocated. My questions basically are:
1) Is it possible to dynamically allocate static variables, and allow the variables to dynamically allocated and destroyed once a routine has been completed? If so how?
2) Is making the hwnd variables dynamically allocated worth it? Does it actually save a considerable amount of memory?
Any help would be appreciated
Thanks,
Robbie
|
|
|
|
|
wrote:
EndDialog(hwnd, 0);
delete tab1_hwnd;
delete tab2_hwnd;
delete tab3_hwnd;
delete tab4_hwnd;
delete tab5_hwnd;
delete tab6_hwnd;
delete CurrentTabHwnd;
delete CurrentTabIndex;
delete hwndTab;
Instead of this try to call the EndDialog(hwnd, 0); after deleting all the tabs.it may resolve your problem
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
Hey man,
lol thanks for the fix, but I ran into a BIG problem. When I ran the program and closed the dialog box, I got my 8th (i think?) ever BSoD and some very weird exorcist sounds coming from my speakers. So dont think that worked out too well. Any other ides you may have?
Robbie
|
|
|
|
|
I think the problem is because of multiple delete operations performed on the same pointer. You probably believe that a line like
static HWND* tab1_hwnd = new HWND;
within a function allocates the object on each execution of that function. This is not true: the pointer is allocated once.
You can change it like this:
static HWND* tab1_hwnd = NULL;
...
case WM_INITDIALOG:
tab1_hwnd = new HWND;
. . .
case WM_CLOSE:
::DestroyWindow(*tab1_hwnd);
delete tab1_hwnd;
tab1_hwnd = NULL;
. . .
Actually HWND is not so a big object. It takes only 4 bytes. Therefore you can work without pointers:
static HWND tab1_hwnd = NULL;
|
|
|
|
|
Ok thats cool, I'll just take out the pointers since its easier that way. Thanks for your help guys.
|
|
|
|
|
Hi All
I have been puzzelled in a problem,
What have to do is, that I have some file names ( like 000001.doc, programming.doc, etc.) now I have to find out the files that are in hexadecimal (leaving file extension).
Please guide me to find out this
Thanks
|
|
|
|
|
Use isxdigit() on the file's name.
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Ahh david's is a much easier way. Its in the following library as well!
#include <ctype.h>
int isxdigit(int c);
|
|
|
|
|
1) Retrieve the file list
2) Loop through each file. For every File name, loop through its name until the extension is reached and check to see if each character is either [0-9] or [A-F]. If its not, just do continue; and start back at the beginning of the loop again. Use this website to utilize the ANSI character set.
http://www.alanwood.net/demos/ansi.html
Remember, the letters can be either lower case or uppercase and have different ANSI codes.
3) Record the file names in an array. (Create a dynamic allocated array for big file names).
Robbie
|
|
|
|
|
Try this idea:
char name[100] = "......." ;
char * p;
strtoul(name, &p, 16);
if( *p == 0)
{
}
else
{
}
Hope it helps.
|
|
|
|
|
I'm trying to in corporate a \n in a CString variable I thought that you could use the format function to do that. Here's the code:
CString look;
look.Format("Original text: <%s>\n"
"Uppered: <%s>\n"
"CompareNoCase says they differ!\n"
"Lowered again: <%s>\n\n"
"Conclusion: CompareNoCase doesn't work correctly!");
AfxMessageBox(look);
But then I keep getting the following errors:
c:\documents and settings\....cpp(102) : error C2664: 'void ATL::CStringT<basetype,stringtraits>::Format(const wchar_t *,...)' : cannot convert parameter 1 from 'const char [137]' to 'const wchar_t *'
with
[
BaseType=wchar_t,
StringTraits=StrTraitMFC_DLL<wchar_t>
]
Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Build log was saved at "file://c:\Documents and Settings\kmil\Desktop\tst\LEDs_try2\LEDs_try2\Debug\BuildLog.htm"
LEDs_try2 - 1 error(s), 0 warning(s)
could someone explain to me what i'm doing wrong?
Thanks,
Kitty5
|
|
|
|
|
if you use a parameter in the format of the CString::Format() function, you must provide an additionnal parameter...
CString str;
str.Format("Hello %s...!", "Kitty");
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
Instead of:
"Original text: <%s>\n"
"Uppered: <%s>\n"
"CompareNoCase says they differ!\n"
"Lowered again: <%s>\n\n"
"Conclusion: CompareNoCase doesn't work correctly!"
try this:
_T("Original text: <%s>\n")
_T("Uppered: <%s>\n")
_T("CompareNoCase says they differ!\n")
_T("Lowered again: <%s>\n\n")
_T("Conclusion: CompareNoCase doesn't work correctly!")
This is because you are compiling an Unicode application. The _T macro allows you to make programs for both Unicode and ANSI modes.
-- modified at 9:04 Friday 16th June, 2006
|
|
|
|
|
I've tried that... but then I get an "Unhandled exception at 0x102212de (msvcr80d.dll) in LEDs_try2.exe: 0xC0000005: Access violation reading location 0x59199e91..." error. And when you go to debug it opens up the file output.c and points to line 1627 which is:
while (i-- && *pwch)
Kitty5
|
|
|
|
|
i already answered...
you wrote this :
look.Format("Original text: <<font color=red>%s</font>>\n"
"Uppered: <<font color=red>%s</font>>\n"
"CompareNoCase says they differ!\n"
"Lowered again: <<font color=red>%s</font>>\n\n"
"Conclusion: CompareNoCase doesn't work correctly!");
but where are the parameters ?!!!
TOXCCT >>> GEII power
[VisualCalc 3.0 updated ][Flags Beginner's Guide new! ]
|
|
|
|
|
sorry I put up the wrong text...
I don't have any parameters so it's:
look.Format("Original text: \n"
"Uppered: \n"
"CompareNoCase says they differ!\n"
"Lowered again: \n\n"
"Conclusion: CompareNoCase doesn't work correctly!");
Kitty5
-- modified at 9:18 Friday 16th June, 2006
ok yes... i am an idiot... maybe i should get more coffee...
|
|
|
|
|
Look at the answer from toxcct (above).
-- modified at 9:14 Friday 16th June, 2006
Twice, now.
|
|
|
|
|
OK... I am working with an IDispatch -based interface that needs to be completely automation capable (i.e. it uses the Typelib Marshaller - no custom marshalling).
Now, AFAICT:
o I can pass structures over an IDispatch -based interface as the structures consist solely of automation-capable types
o I can pass arrays of automation-capable types over IDispatch -based interfaces using SAFEARRAY (possibly wrapped within a VARIANT )
(For now, ignore the fact that some clients, like VBScript , may be unable to handle these kinds of parameters.)
However, I cannot seem to find information telling me that both are possible at the same time. IOW, I want to pass an array of structures across an IDispatch -based interface. The only information I can find regarding passing arrays of structures indicates that I will have to serialize the data to a byte stream and then send the raw bytes over the wire wrapped in a SAFEARRAY of VT_I1 types.
While I am sure I can make that work, and can provide clients with information on how to decode the structures, this feels kinda 16-bit-ish to me, and not just a little quick-n-dirty.
So, does anyone know if it is possible to pass arrays of structures over IDispatch-based interfaces, or do I have to do the byte-stream route? If so, please point me to the relevant documentation.
Adva[Thanks]nce! (Cheesy, I know... )
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
plz tel me how to change the color of text in a edit control or static control and also tem how to change color of edit control plz tem me some example (code to understabd is easy) plz.....................
Please mail me
-- modified at 8:34 Friday 16th June, 2006
|
|
|
|
|
In OnCtlColor function add this block of code :
Define in the header file as follows in the public section:
COLORREF m_color;
HBRUSH m_brush;
if (pWnd->GetDlgCtrlID () == IDC_EDIT1)
{
pDC->SetBkColor(m_color);
hbr = m_brush;
}
if (pWnd->GetDlgCtrlID () == IDC_EDIT2)
{
pDC->SetBkColor(m_color);
hbr = m_brush;
}
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
-- modified at 8:18 Friday 16th June, 2006
|
|
|
|
|
<br />
HBRUSH CAnswerDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)<br />
{<br />
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);<br />
pDC->SetTextColor(RGB(54,97,200));
return hbr;<br />
}<br />
whitesky
|
|
|
|
|