|
Hello everyone,
I have a prebuild step which needs the following command/parameters....
IncBuild gpi.rc VS_VERSION_INFO$(_GPI6800)
However, Dev studio wants to use the $(_GPI6800) as a macro substitution rather than directly as I typed it in.
Anyone have any idea how I stop the subtitution?
TIA
James
|
|
|
|
|
Have you tried to just enclose it in quotes? Maybe escaped quotes (i.e. prepended by a backslash)?
If that won't work, you might consider replacing the dollar sign with something that isn't a documented macro initiation character.
|
|
|
|
|
Not sure this will work (as I have never used prebuild), but you could create a *.bat file with the command and call the bat file from prebuild.
|
|
|
|
|
Hello
My WINNT application crashes at startup.
I use quite a few threads in the program. It normally happens when there is data coming in at the Asynch comm port. When i disconnect the comm cable then there in NO crash at startup.
The DR Watson message says, "Access voilation : 0xc000005, Address : 0x0000080.
When I look in the Map file of the Released version, the address mentioned can only be found around :
comct132:COMCTL32.dll
0002:00000080 _imp_ImageList_ReplaceIcon@12 00476080
Does anyone perhaps know how I should continue from here to find the problem.
Thanks
Louis
|
|
|
|
|
Sounds like the rx thread is receiving data before other threads have started up, perhaps expecting some processing done by other threads which doesnt get done?
Can you delay that thread until all the others have started, or at least all initialisation is complete?
James
|
|
|
|
|
Thanks James
Adding a delay, thus waiting for all threads to startup solved the crash problem at startup.
Thanks again for your input.
Cheers
Louis
|
|
|
|
|
I build an interface splitted in two view : a CTreeView (at left) and a CScrollView (right) where i can draw chronogramms.
when i select a HTREEITEM , i want to draw a chronogramm which depends on the HTREEITEM.
The problem is that i need to move the splitbar to refresh the CScrollview after having selected the HTREEITEM to have my new chronogramm...
I use the OnDraw function in my ScrollView in which i call "Trace" function which draw chronogramms.
If u could help me.....ty
Sorry for my english i am french
Franck
|
|
|
|
|
Call RedrawWindow() on your CScrollView object when you get a TVN_SELCHANGED in your CTreeView window.
|
|
|
|
|
I need to insert OnSelchanged(NMHDR* pNMHDR, LRESULT* pResult) function in my CTreeView ?? function create when i add a windows message handler for TVN_SELCHANGED
where can i find the RedrawWindow() function ??
|
|
|
|
|
I normaly dont program MFC (just Win32 for me). But if the wizard dont add a OnSelchanged you will have to add it your self. And in that function call RedrawWindow() which is a member of CWnd which CScrollView inherits from.
|
|
|
|
|
ok it is what i do but it does not work...
the RedrawWindow(); function redraws which view ?? not my scrollview...
i want thats that when an HTREEITEM is selected, my ScrollView will be updated...
|
|
|
|
|
RedrawWindow redraws the window its called on.
CScrollView scrollViewObj;
scrollViewObj.RedrawWindow();
You ofcourse already have an object of CScrollView, call RedrawWindow() on that object and it should work. If that dont work, your WM_PAINT is probably implemented wrong.
|
|
|
|
|
hi guys
i wanna learn abt the directx programming in vc++6,if any one of u have any material on that , so plz send me,
waiting for reply
bye
Adeel
|
|
|
|
|
|
|
I'm trying to display a dialog box with two tabs. When the dialog displays it shows the tab control and the child dialog for the first tab ok. When I click on the second tab the child dialog disappears but the new child dialog does not appear. Clicking on the first tab again has no effect. So the initial display is ok but clicking on a tab causes the tab contents to disappear. The code i'm using is:
====== resources =====
IDD_DIALOG1 DIALOG DISCARDABLE 0, 0, 242, 156
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Dialog"
FONT 8, "MS Sans Serif"
BEGIN
CONTROL "Tab1",IDC_TAB1,"SysTabControl32",0x0,7,24,228,99
DEFPUSHBUTTON "OK",IDOK,56,135,50,14
PUSHBUTTON "Cancel",IDCANCEL,140,135,50,14
END
IDD_DIALOG2 DIALOGEX 0, 0, 100, 50
STYLE DS_CONTROL | WS_CHILD | WS_BORDER
EXSTYLE WS_EX_NOPARENTNOTIFY | WS_EX_CONTROLPARENT
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "tab 1",IDC_STATIC,24,22,17,8
CONTROL "Check1",IDC_CHECK1,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,50,18,43,7
END
IDD_DIALOG3 DIALOGEX 0, 0, 100, 50
STYLE DS_CONTROL | WS_CHILD | WS_BORDER
EXSTYLE WS_EX_NOPARENTNOTIFY | WS_EX_CONTROLPARENT
FONT 8, "MS Sans Serif"
BEGIN
LTEXT "tab 2",IDC_STATIC,23,17,17,8
CONTROL "Check2",IDC_CHECK1,"Button",BS_AUTOCHECKBOX |
WS_TABSTOP,53,23,40,7
END
===== main code =====
INITCOMMONCONTROLSEX inc;
inc.dwICC = ICC_TAB_CLASSES ;
InitCommonControlsEx(&inc);
DialogBox(ghInst,MAKEINTRESOURCE(IDD_DIALOG1),hWnd,(DLGPROC)Dialog1Proc);
===== dialog proc =====
#include "stdafx.h"
#include "resource.h"
#define C_PAGES 2
typedef struct tag_tabhdr
{
HWND hTab; // tab control
int iIndex; // current tab index
BOOL bValid; // current tab status
HWND hDlg[C_PAGES]; // child windows
} TABHDR;
LRESULT CALLBACK Dialog1Proc(HWND hDlg,UINT uMsg,WPARAM wParam,LPARAM lParam)
{
extern HANDLE ghHeap;
extern HINSTANCE ghInst;
static TABHDR th;
switch(uMsg)
{
case WM_INITDIALOG:
{
DWORD dw;
POINT pt;
RECT rc;
char szMsg[256];
char szStr[128];
TCITEM tci;
// add a tab for each of the child windows
th.hTab = GetDlgItem(hDlg,IDC_TAB1);
memset(&tci,0,sizeof(TCITEM));
tci.mask = TCIF_TEXT;
tci.iImage = -1;
LoadString(ghInst,IDS_DATES,szStr,sizeof(szStr));
tci.pszText = szStr;
TabCtrl_InsertItem(th.hTab,0,&tci);
LoadString(ghInst,IDS_NOTES,szStr,sizeof(szStr));
TabCtrl_InsertItem(th.hTab,1,&tci);
// set tab control display area
GetWindowRect(th.hTab,&rc);
TabCtrl_AdjustRect(th.hTab,false,&rc);
pt.x = rc.left;
pt.y = rc.top;
ScreenToClient(hDlg,&pt);
// create the child windows
th.hDlg[0] = CreateDialog(ghInst,MAKEINTRESOURCE(IDD_DIALOG2),hDlg,(DLGPROC)PersonDatesProc);
MoveWindow(th.hDlg[0],pt.x,pt.y,rc.right-rc.left,rc.bottom-rc.top,false);
ShowWindow(th.hDlg[0],SW_HIDE);
th.hDlg[1] = CreateDialog(ghInst,MAKEINTRESOURCE(IDD_DIALOG3),hDlg,(DLGPROC)PersonNotesProc);
MoveWindow(th.hDlg[1],pt.x,pt.y,rc.right-rc.left,rc.bottom-rc.top,false);
ShowWindow(th.hDlg[1],SW_HIDE);
// simulate selection of the first tab
th.iIndex = 0;
th.bValid = TRUE;
TabCtrl_SetCurSel(th.hTab,0);
ShowWindow(th.hDlg[0],SW_SHOW);
BringWindowToTop(th.hDlg[0]);
return false;
}
break;
case WM_PAINT:
{
HDC hDC;
PAINTSTRUCT ps;
hDC=BeginPaint(hDlg,&ps);
EndPaint(hDlg,&ps);
}
break;
case WM_NOTIFY:
{
int iTab;
NMHDR * pnmh;
pnmh = (NMHDR *)lParam;
switch(pnmh->code)
{
case TCN_SELCHANGING:
{
// validate the tab page
iTab = TabCtrl_GetCurSel((HWND)pnmh->hwndFrom);
SendMessage(th.hDlg[iTab],UM_VALIDATE,(WPARAM)&th.bValid,0);
// return zero to allow tab to change, non-zero to prevent it
if(th.bValid)
return 0;
else
return 1;
}
break;
case TCN_SELCHANGE:
{
if(th.bValid)
{
ShowWindow(th.hDlg[th.iIndex],SW_HIDE);
th.iIndex = TabCtrl_GetCurSel((HWND)pnmh->hwndFrom);
ShowWindow(th.hDlg[th.iIndex],SW_SHOW);
BringWindowToTop(th.hDlg[th.iIndex]);
}
}
break;
}
}
break;
case WM_COMMAND:
{
HWND hCtl;
WORD wID;
WORD wCmd;
wID = LOWORD(wParam);
wCmd = HIWORD(wParam);
hCtl = (HWND)(UINT)lParam;
switch(wID)
{
case IDOK:
{
int iTab;
int iTabs = C_PAGES;
// destroy child windows
for (iTab=0;iTab
|
|
|
|
|
Shouldn't the dialog templates have the WS_VISIBLE style?
|
|
|
|
|
I would like to get the type of control (Combobox, Button etc.) at runtime by the CtrlId to use it in a loop of all controls of a Dialog.
Is there a possibility?
I tried for example
pWnd->GetDlgItem(pWnd->GetDlgCtrlID());
CRuntimeClass *RuntimeClass;
RuntimeClass = pWnd->GetRuntimeClass();
But the Return of GetRuntimeClass was always "CTempWnd"
Does anyone know a solution. I think it must be simple if you know it.
Thanks.
|
|
|
|
|
MarcoNedwig wrote:
pWnd->GetDlgItem(pWnd->GetDlgCtrlID());
That's... weird
Use:
TCHAR szClassName[200];
::GetClassName(GetDlgItem(IDC_OF_CONTROL)->m_hWnd,
szClassName, 200);
rechi
|
|
|
|
|
int GetClassName(
HWND hWnd, // handle of window
LPTSTR lpClassName, // address of buffer for class name
int nMaxCount // size of buffer, in characters
);
pWnd->GetDlgItem(pWnd->GetDlgCtrlID());
::GetClassName( pWnd->GetSafeHwnd(), sClassName.GetBuffer(64), 64);
sClassName.ReleaseBuffer();
sClassName == "EDIT", "LIST", "BUTTON" etc
|
|
|
|
|
What if the window does not belong to your application?
Suppose I only have a Handle to another Window running on the system, how do you GetDlgItem for such a situation?
Thanks,
Jim ô¿ô
|
|
|
|
|
I'd like to pass a string from an app to another using a user-defined message and SendMessage I'm receving the message but when i typecast wParam, I do not get my string but "IIIIIIIII...III" even if types and memory address match in both application when debugging.
What's wrong ?
~RaGE();
|
|
|
|
|
You can not pass pointers from one process (that is Adress Spece) to another.
You can pass them from thread to thread, but not from app to app.
The memory has a different use in the other address space.
Insted, you have to use e.g. the clipboard, a memory mapped file, or (I am not sure) GlobalAlloc might work.
My opinions may have changed, but not the fact that I am right.
|
|
|
|
|
Typecast as
CString* pString = (CString*)l; // l is the lParam value
|
|
|
|
|
jhwurmbach is basically right:
The adress space is different between processes (i.e. the same virtual address refers to different physical locations, and you might not even have access rights to that location)
A typical solution would be a memory mapped file (relatively easy to create, yet quite flexible).
Another option is a WM_COPYDATA message. You will receive a copy of the data (but this is valid only while the message is processed, so create your own copy on the client side)
for a CString:
Sender:
CString myString = ...
COPYDATASTRUCT cds;
cds.dwData = 0;
cds.cbSize = (myString.GetLength()+1) * sizeof(TCHAR);
cds.lpData = (LPCTSTR) myString;
::SendMessage(hwndReceiver, WM_COPYDATA, (WPARAM) hwndSender, (LPARAM) &cds); Receiver - WM_COPYDATA handler:
HWND sender = (HWND) wParam;
COPYDATASTRUCT & cds = *(COPYDATASTRUCT *)cds.lpData;
CString receivedString = (LPCTSTR) cds.lpData;
Note: this does not handle passing from UNICODE app to ASCII/MBCS app (or vice versa) correctly
"Der Geist des Kriegers ist erwacht / Ich hab die Macht" StS
sighist | Agile Programming | doxygen
|
|
|
|
|