|
I have a Edit Control field to enter variable Numbers and a Combo box from 1 to 10, every Index in Combo Box has to have a certain changed Edit Control Number.
A the End The edit control numbers are saved for each Combo box index, just like this:
Combo box index: 1------------->entered Number in Edit Controll for example 67.3
2--------------------------------->234.7
3--------------------------------->90
10------>
so if i return to Combo Box index 1 i will find 67.3 , for 3 --> 90 and so ...
Best Reguards!!
|
|
|
|
|
|
Hi,
i'm a beginner to all this so pls forgive me if this is a silly qn...i hv a dll that works on win 98 but i recently migrated to win xp. I've changed the project settings to _Unicode but i'm not sure how to modify the code so that it works the same way on win xp. For eg. how do i use AfxMessageBox? Also, how do i use CFileDialog class?
The code i hv is:
CFileDialog filenewdlg(TRUE, NULL, NULL, OFN_ALLOWMULTISELECT |OFN_HIDEREADONLY, "Part Files(*.asm)|*.sldasm||", this);
But on compiling, the error i get is
cannot convert parameter 5 from 'char[29]' to 'const unsigned short'
1) How do i correct this?
2) Is there anything else i need to know?
Best regards and thanks in advance...
|
|
|
|
|
If you are going to do a unicode project then all strings must begin with L eg. L"Part Files(*.asm)|*.sldasm||" to tell the compiler you want a wide string.
But I would recommend you read up on TCHAR, that way you can compile your program in both UNICODE and single byte mode.
I dont know any good unicode resource on the web, but if you are going to do a unicode project, then I recommend you read some books on the subject. Its a lot more to unicode than meets the eye.
Also here on codeproject is
http://www.codeproject.com/cpp/unicode.asp?target=unicode[^]
http://www.codeproject.com/vcpp/stl/upgradingstlappstounicode.asp[^]
Magnus
|
|
|
|
|
CListCtrl m_List ;<br />
m_List.ModifyStyle(0, LVS_LIST) ;<br />
<br />
CImageList ListImage ;<br />
HIMAGELIST hList = ImageList_Create(16, 16, ILC_COLOR8 | ILC_MASK, 8, 1) ;<br />
ListImage.Attach(hList) ;<br />
<br />
CBitmap bmp ;<br />
bmp.LoadBitmap(IDB_BITMAP1) ;<br />
ListImage.Add(&bmp, RGB(255,0,255)) ; <br />
<br />
m_List.SetImageList(&ListImage, LVSIL_SMALL) ;<br />
<br />
<br />
LVITEM lvi ;<br />
CString strItem ; <br />
<br />
m_List.DeleteAllItems() ;<br />
<br />
for (int i=0; i<9; i++)<br />
{<br />
strItem.Format(_T("Item %i"), i) ;<br />
lvi.mask = LVIF_IMAGE | LVIF_TEXT ; <br />
lvi.iItem = i ;<br />
lvi.iSubItem = 0 ;<br />
lvi.pszText = (LPTSTR)(LPCTSTR)(strItem) ;<br />
lvi.iImage = i ;<br />
m_List.InsertItem(&lvi) ; <br />
m_List.SetItemData(i, i+100) ;<br />
}
Yes, this was the code I wrote for the CListCtrl object.
The Problem is it won't display the images in the list control.
Can anybody tell me what's wrong with the code.
Regards,
-The Phantom
|
|
|
|
|
Hi..
following problems:
i have got a project with dialogs with a lot of activeX elemts on it (the form elements from microsoft)
the program runs & compiles fine under WinNt4.0
when i run & compile the program under Win2k i have got the following program.
Before it jumps into "OnInitDialog" the Dialog is closed (e.g. PostNCDestroy is called)..
The error (difference) occured at this piece of code.
BOOL CWnd::CreateDlgIndirect(LPCDLGTEMPLATE lpDialogTemplate,
CWnd* pParentWnd, HINSTANCE hInst)
{
....
m_nModalResult = -1;
m_nFlags |= WF_CONTINUEMODAL;
AfxHookWindowCreate(this);
hWnd = ::CreateDialogIndirect(hInst, lpDialogTemplate,
pParentWnd->GetSafeHwnd(), AfxDlgProc);
if (hWnd != NULL && !(m_nFlags & WF_CONTINUEMODAL))
{
::DestroyWindow(hWnd);
hWnd = NULL;
}
..
}
Any Ideas anyone ?
Thanks in advance,
Bernhard
"I'm from the South Bronx, and I don't care what you say: those cows look dangerous." U.S. Secretary of State Colin Powell at George Bush's ranch in Texas
|
|
|
|
|
When I've had dialogs failing to create, its (alomst) always because one of the child windows failed
to create. To check this, set the "no fail create" style of the dialog. This should make the dialog
appear, but with a gap. You'll have to make sure your OnInit routines don't try to set things on the
non-existent control.
Then investigate the non-appearance of that particular control.
I hope that helps a little.
Iain.
|
|
|
|
|
Thank you...
this really helped!
indeed it was a problem with a child window (a.k.a. control).. never heard of the "no fail create" (and i think it is funny that you have to set it to true that it creates the dialog when something fails.. )
thanks..
bernhard
"I'm from the South Bronx, and I don't care what you say: those cows look dangerous." U.S. Secretary of State Colin Powell at George Bush's ranch in Texas
|
|
|
|
|
I have a Dialog with progress bar and status bar.
System has to perform some processing on number of TXT files, those will be opened,processed and closed, by other function of another class.
UI has to be updated with name of file in the status bar and also progress bar has to be pisitioned according to the number of files processed.
I am using VC++, and Worker threads, updating a global structure with file name and count,
But the problem is UI is not getting updated, and Its Dialog based application.
Any suggesstions ?? Any tutorials are avilable on Threads, Events ...online
Thanks in advance
Warm Regards,
KKR
|
|
|
|
|
I would like to know how do u notify your dialog with progress control to update it self.
I am sure that this would have given u the solution to your problem.
One way of doing this is u send message to the dialog box to update when u update the global structure.
|
|
|
|
|
KKR wrote:
Any tutorials are avilable on Threads, Events ...online
http://www.flounder.com/mvp_tips.htm[^] has (among others) a very good tutuorial about threads.
Hope this helps!
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
I am a nebie in VC++.
Currently i am doing a project which makes use of a webcam. But i do not know how to get the handle of the camera to begin with. Can anyone kindly tell me??
Thanks,
nwillie
|
|
|
|
|
Well, actually I don't even know what the problem is.
It's like this. I have a dialog box which reads some values from a file to initialize itself. I do this in OnInitDialog() . Fine. But when the dialog finally shows up, one of the checkboxes is not checked. I mean, it should have been, according to the settings it reads from the file. I checked the value just after reading the settings, to make sure that it's indeed getting read properly. It is. After ReadSettings() (my function which reads the settings and puts them in variables), the values are just what they should be. At the end of this function UpdateData(FALSE) is called to put these values in the controls on the dialog box to which they correspond. Things are just as they should be, except for one particular checkbox. And after UpdateData() the value of the variable is also somehow set to FALSE on its own. WTF is going on? When I try to change the settings or something, and write the new values back into the file, they get written properly, including for this checkbox. So the variable is properly connected to the control. But what happens during UpdateData(FALSE) ? Or am I looking at the problem in an entirely wrong way?
I'm not a newbie or anything. But this thing has me baffled. I must be missing something very very obvious and stupid. I very rarely ask for help, but in order to save the walls around me from developing cracks from banging my head on them, I must do so now.
Suggestions, please? I need to get this done today. Doh. Stupid me.
Regards,
Rohit Sinha
Do not wait for leaders; do it alone, person to person. - Mother Teresa
|
|
|
|
|
I know this kind of hassle with the stupid UpdateData() part. There is so much happening behind your back, you never know what went wrong! I tend to drop DDX/DDV entierly, have the class wizard make me some control-variables and do the data transfer myself.
I know when to do what, like validating on each keypress, or on the TAB-key or..or..or.
All DDX/DDV can is validate on OK-Button.
Having said that, All I can think of at the moment is the following:
The variable you are setting IS connected with the right control?
Look it up in the DDX_TEXT() macros at the top of the cpp.
You can set a breakpoint on the macro and step through the DDX-function.
Hope that helped
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
Well, sometimes we are stupid and sometimes we don't follow the docs. That's what happened with me.
I was reading a particular value from a file. After that I was bitwise OR'ing it with a few numbers to see what was up and assigning the result to a BOOL ean variable (which was connected to a checkbox). I forgot that if the value is anything other than 0, 1 or 2, the DDX routines will reset it to 0.
DOH!!!
Thanks to your advice of stepping through the code (why didn't I think of it myself?) I was able to spot it.
Thanks again for listening to me and offering your suggestions. It helped me a lot.
About doing the data transfer yourself, I avoid it as much as possible, because in most cases it's not necessary and I don't want to have to remember to do it each time. Data validation is a different game though. Best done by hand.
Regards,
Rohit Sinha
Do not wait for leaders; do it alone, person to person. - Mother Teresa
|
|
|
|
|
Souns like a silly, I assume you are using the MFC? try deleteing and the name of the member variable of the check box and then compile, are there any errors.
Now add a new member variable name, and set it TRUE or FALSE manually.
If this fails then you are probably overwritng some memory location.
Or comment out everything possible from the class, does it still fail?
Good luck!
It is amazing what you can accomplish if you do not care who gets the credit. - Harry S Truman
|
|
|
|
|
You're likely to solve the problem by using member control variables instead of UpdateData() . See jhwurmbach's comment.
|
|
|
|
|
Hi dear,
I created a thread.
But when I start the thread CPU load become 100%.
I use these code.
<br />
void CtestDlg::BeginThread()<br />
{<br />
m_isRunning = TRUE;<br />
AfxBeginThread(ThreadStart,this,THREAD_PRIORITY_LOWEST);<br />
}<br />
<br />
UINT CtestDlg::ThreadStart(LPVOID pParam)<br />
{<br />
CtestDlg* pDlg = (CtestDlg*)pParam;<br />
if (pDlg == NULL || !pDlg->IsKindOf(RUNTIME_CLASS(CtestDlg)))<br />
return 1;
<br />
while(pDlg->m_isRunning)<br />
pDlg->Start();<br />
<br />
return 0;
}<br />
<br />
void CtestDlg::Start()<br />
{<br />
}<br />
Start function doesn't have any code.
Thank you in advance.
|
|
|
|
|
your while loop will generate 100% cpu, since you dont have any kind of blocking code inte CtestDlg::Start. What the CPU is doing is calling Start all the time.
Magnus
|
|
|
|
|
I´m new to DirectX 8.1 and I have a problem in windowed mode. When I use SDI type app and tris are rendered in filled mode, when I resize a window, the app works correctly. Image stretches, but correctly, same way as OpenGL does. But when I switch to wireframe, all goes wrong. Lines appear thinner or thicker, as if you stretch a bitmap. In MDI, when I use additional swap chains, this problem occurs everytime, i.e. in filled mode. I use vertex buffer initialized in OnInitialUpdate(). Antialiasing is off.
|
|
|
|
|
So you are using Direct3D DM? You should realize that lines are actually very thin polygons in Direct3D - so as to minimize the calling structures. This may be the root of the problem.
This sounds like you are transforming the viewport instead of the projection matrix as a response to changing of the window size.
If not, There are also hardware accelerator problem sometimes - check to see if it does the same thing on a different video card - or turn off hardware acceleration in the Windows display options.
|
|
|
|
|
Is there an API call that can be used to detect if the system is Shutting down/Restarting or Logging Off.
I've got a program that runs as a scheduled task, and sometimes when the user logs off, the Program Wait...End Now comes up or the "application couldn't start because the terminal is shutting down", because the scheduled task is started each 5 minutes. I want to prevent the error, is there anything I can do?
|
|
|
|
|
Have a look at WM_QUERYENDSESSION:
WM_QUERYENDSESSION
The WM_QUERYENDSESSION message is sent when the user chooses to end the session or when an application calls the ExitWindows function. If any application returns zero, the session is not ended. The system stops sending WM_QUERYENDSESSION messages as soon as one application returns zero.
After processing this message, the system sends the WM_ENDSESSION message with the wParam parameter set to the results of the WM_QUERYENDSESSION message.
WM_QUERYENDSESSION
nSource = (UINT) wParam;
fLogOff = lParam Parameters
nSource - Reserved for future use.
fLogOff - Value of lParam. Indicates whether the user is logging off or shutting down the system. Supported values include: ENDSESSION_LOGOFF.
Return Values
If an application can terminate conveniently, it should return TRUE; otherwise, it should return FALSE.
Dominik
_outp(0x64, 0xAD);
and
__asm mov al, 0xAD __asm out 0x64, al
do the same... but what do they do??
(doesn't work on NT)
|
|
|
|
|
Good Morning,
I am developing an application in MFC VC++ Version 6.0 for Windows 2000
I need some help.
How can we convert CSTring to LPCSTR
I have a function in which I neet to pass LPCSTR type agument.
myprogram()
{
CString str;
//
//how to convert this str to LPCSTR
//
myfunc(str)---???
}
myfunc(LPCSTR str)
{
....
....
...
}
Waiting for a positive response.
Rohit
|
|
|
|
|
|