|
Hi,
from your code I can see that src isn't modified!
you are only modifying dst! src is only readed.
And, question, how dst come outside the function setState?
Have a nice code day
|
|
|
|
|
I instantiate the initialization variable and hope initialization is passed as a paramter into the setState function. But it doesn't work. *(dst++) = *(src++) is just an example which means I want to pass the values in src array into another data structure.
Asura
|
|
|
|
|
Ok,
but what you wrote on the first message is correct, there isn't errors!!
The only thing that I don't like very much is that you modify dst (with dst++),
So I hope that you are saving the initial value of dst (from the new float[]) somewhere. Else this is an error!
Bye
Have a nice code day
|
|
|
|
|
Ming Luo wrote: for (int i = 0; i < 6*n; i++)
*(dst++) = *(src++);
Consider revising this to:
for (int i = 0; i < 6*n; i++)
{
*dst = *src;
dst++;
src++;
} or
for (int i = 0; i < 6*n; i++)
dst[i] = src[i];
"The greatest good you can do for another is not just to share your riches but to reveal to him his own." - Benjamin Disraeli
|
|
|
|
|
Hello,
I would like to see the usage count of dll that how many applications are currently using my dll?
Thanks,
Software Developer
Sanjay Khapre
|
|
|
|
|
Hello,
Maybe you can increment some counter when your DLL is attached to a process and decrement it when the DLL detaches?
How you visualize the counter is trivial...
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Bob's suggestion will work using shared memory. He's how I'd do it:
------------------------------------------------------------------
#include "stdafx.h"
#pragma data_seg("Shared")
LONG g_Count = 0;
#pragma data_seg()
#pragma comment(linker, "/SECTION:Shared,rws")
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
)
{
switch (ul_reason_for_call)
{
case DLL_PROCESS_ATTACH:
InterlockedIncrement(&g_Count);
break;
case DLL_PROCESS_DETACH:
InterlockedDecrement(&g_Count);
break;
}
return TRUE;
}
---------------
Note that the g_Count is in shared memory so take care to synchronise access.
Steve
|
|
|
|
|
I am trying to put a simple edit control in the dialog box and on OK trying to echo the text in the edit box.
The On Button Clicked OK function looks like this
void CHelloDlgDlg::OnBnClickedOk()
{
UpdateData(TRUE);
AfxMessageBox(m_strMsg);
}
I right clicked on the edit control, added a variable called m_strMsg of type CString.
But on click of OK, I am getting a blank string. I debugged through to find out that my DoDataExchange method looks like this:
void CHelloDlgDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
}
whereas it is expected to look like this:
void CHelloDlgDlg::DoDataExchange(CDataExchange* pDX)
{
DDX_Text(pDX, IDC_EDIT1, m_strMsg);
CDialog::DoDataExchange(pDX);
}
I am working on Visual studio 2003, and I have created a new project in this framework as an MFC Application. Why is the DDX_Text(...)part of the code not getting generated??
Do I have a buggy version, or am I supposed to be including some files, or change settings or do the member variable assignation in a different way?? I am new to VS 2003, but have worked on VS 6 before. Pl help as I need to know before starting some more complex coding, if the s/w had a problem during installation.
Thanks
ARK
|
|
|
|
|
I've just checked, VS 2003 will add the DDX line for you. I don't think it's a dodgy installation you have there, I think it's more likely you unchecked the "Control variable" check box in the "Add member variable wizard".
Try it again to check, making sure that check box is checked, and see if the DDX line is there.
- Dy
|
|
|
|
|
I had indeed unchecked the Control checkbox(because the sample program said so), so I tried what you have suggested, but then instead of generating DDX_Text, DDX_Control got generated and it could not recognize the CString variable. So there was a compilation error Is it something to do with CString not being recognized or something? But then, I did try with other datatypes (char and int), but even then it does not work. I am really at a loss!
ARK
|
|
|
|
|
A 'default' DoDataExchange looks like this:
void CMyDlg::DoDataExchange(CDataExchange* pDX)<br />
{<br />
CDialog::DoDataExchange(pDX);<br />
}
If you deleted the AFX_DATA_MAP lines, then the ClassWizard does not know where to
write the 'DDX' source code. Add those lines back in, obviously changing the name to that of your dialog class, and it should work fine.
People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks
|
|
|
|
|
Two things that puzzle me..if that is how the default DoDataExchange looks, how come mine doesn't look like that? I don't have those AFX_DATA_MAP lines. And after I included them (I tried both including them before creating a variable for the control and after the 1st build where the DDX_Text did not get generated), I still have the same problem. I tried out a few other steps too (of changing the datatype of the variable), which I have detailed in my reply to Dy's posting. Pl help me with this. Thanks
|
|
|
|
|
http://www.thecodechannel.com/boards/topic.asp?TOPIC_ID=13[^]
I found the answer for this problem in this link (happens I was following the same book by Tom Archer). Dy, you are right, it is to do with checking the control checkbox; additionally I needed to change the Category from Control to Value. Thanks.
|
|
|
|
|
Hey guys,
My question may seem very simple to most of you, but for me it aint'so easy. I am trying to make a simple application which will create some controls, such as simple buttons, on left mouse button click; and then destroy all the controls if the right mouse button is clicked, but leaving the main window alone.
In reality, I want everything to happen in my main window, without any dialog windows, pop-up windows with controls, or menus - none of that. I was actually trying to make a quiz-like application which will have 5 different screens (for 5 different questions), with five different "stage set-up scenarios" (different questions will have different screens with different controls, sometimes push buttons, sometimes radio buttons, or something else ...). So is there a way to destroy and re-create these buttons on the main window, or is it the case that once you create them, they can't be destroyed so you have to destroy the main window in order to destroy controls in it too?
Any ideas??? Thanks a lot, y'all!
|
|
|
|
|
I just forgot to say that this is win32API, not MFC.
|
|
|
|
|
DestroyWindow(hWnd);
Owner drawn
Jesus Loves
|
|
|
|
|
DestroyWindow(HWND) destroys it only if I put it in the same block of code, for example if I create it in WM_LBUTTONCLICK block of code, I can destroy it in the same block, but if I try to destroy it in WM_RBUTTONCLICK, this will not work. Why is that? And just to make things clear, I am trying to destroy button that I created in the main window. I dont want to destroy main window, it should stay the same, only the button will be destroyed. Any thoughts on how to do this?
|
|
|
|
|
If you want to destroy the button you have to get the handle of the button and then pass this handle to DestroyWindow to get it destroyed.
Owner drawn
Jesus Loves
|
|
|
|
|
Owner drawn wrote: If you want to destroy the button you have to get the handle of the button and then pass this handle to DestroyWindow to get it destroyed.
Yes, and that is what I do. My button's handle is hBtn1 which I use with DestroyWindow function as DestroyWindow(hBtn1), but nothing happens. Once created, button just sits in its place and I cannot destroy it untill I destroy the main window where it sits.
If I am not making this clear, maybe some code will explain. So here is how I create that button:
case WM_LBUTTONDOWN:
{
hBtn1 = CreateWindow("BUTTON","Picture 1", WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,50,320,70,20,hWindow,(HMENU) 2, hInstGlobal, NULL);
......}
case WM_RBUTTONDOWN:
{
DestroyWindow(hBtn1);
......... }
And that is what I want. On left mouse click I want to create this button in the main window, and on right mouse click I want to get rid of it for good, don't need it any more!
Any ideas why this would not work? Why can't I just call DestroyWindow(hBtn1) and destroy this button?
Thanks! By the way, thanks for working on it Owner Drawn!
-- modified at 23:13 Tuesday 7th February, 2006
|
|
|
|
|
nedimbakic wrote: case WM_RBUTTONDOWN:
{
DestroyWindow(hBtn1);
......... }
WM_RBUTTONDOWN:
{
ShowWindow(hBtn1, SW_HIDE);
DestroyWindow(hBtn1);
}
Owner drawn
Jesus Loves
|
|
|
|
|
That does not work either. I did try to hide it but the damn button just wont go away. It seems as if the button does not recieve messages or something. I have no idea what might be the problem.
-- modified at 7:40 Wednesday 8th February, 2006
|
|
|
|
|
I was able too save the DIALOG DOC output box in a dir. I then saved that file into a RCT file and from that RCT file was able too insert it into powerpoint using the clipboard. Now I can't save without getting OKB instead of 11.8KB.
|
|
|
|
|
Hi!!
I have an mfc sdi application. I have a dialog in which , i had put a text box. I want to open some file(text file), entered by user( in another EDIT CONTROL).
I want that the Edit Control(for displaying file) to remain invisible, until the user clicks on SHOW FILE BUTTON.
Which function should, I use for opening it?? How to do this at button_click??
"If you change then change for the good."
|
|
|
|
|
I think you could:
Open the dialog editor, and in it, set the Visible property of the Second edit to FALSE . Then on button-click, Open the file using:
CFile file;<br />
file.Open("filename.txt",CFile::modeRead | CFile::modeNoTruncate);<br />
int length = file.GetLength();<br />
char* p = new char[length+1];<br />
memset(p,0,length+1);<br />
file.Read(p,length);<br />
file.Close();<br />
m_Edit2.SetWindowText(p);<br />
delete[] p;<br />
m_Edit2.ShowWindow(SW_SHOW);
etc.
this is this.
|
|
|
|
|