|
Got a quick question the following code works in the OnInitDialog function of CPropertySheet, however the same code does nothing in the OnInitDialog function of the CPropertyPage?
// CPropertySheet OnInitDialog code
CRect rect;
CPropertyPage *pPage = GetActivePage();
pPage->GetWindowRect(&rect);
ScreenToClient(&rect);
rect.right += 50;
rect.bottom += 50;
pPage->MoveWindow(&rect);
// CPropertyPage OnInitDialog code
CRect rect;
GetWindowRect(&rect);
ScreenToClient(&rect);
rect.right += 50;
rect.bottom += 50;
MoveWindow(&rect);
Now i know it shouldn't matter to me cause i got it working in the sheet, but it's driving me crazy knowing that this should work in each individual page as well!! Help me understand this craziness
|
|
|
|
|
ok, i have a CFormView that is displaying a form image in the background, and placing text on top of it, this is called CDisplayPrintTemplate, I implemented a dragging hand (like adobe's) which works fine.
now i have a new class which is derived from CDisplayPrintTemplate that puts CEdits on the form. When i try to drag the view the form and the text scroll still, but the CEdits just sit still. I have tried moving the dragging code into my new derived class, but the same thing still happens.. I can drag the scrollbar and scroll the window fine..
void CGAFormsView::OnMouseMove(UINT nFlags, CPoint point)
{
if (m_bDown == TRUE)
{
int nYPos = CFPCF::_round(((m_nStartDragY - point.y)) + m_nStartScrollPosY);
if (nYPos > GetScrollLimit(SB_VERT))
nYPos = GetScrollLimit(SB_VERT);
if (nYPos < 0)
nYPos = 0;
this->SetScrollPos(SB_VERT, nYPos, TRUE);
this->RedrawWindow();
}
else
{
::SetCursor(AfxGetApp()->LoadCursor (IDC_HAND_OPEN));
}
}
so what is different about how i am using SetScrollPos() versus how the scrollbar uses it (the scrollbar works fine)? any idea why can't i update the window without RedrawWindow() which causes everything to flicker?
still a newb.. cut me some slack :P
-dz
|
|
|
|
|
In my mainframe i have:
int nIndex2 = m_wndToolBar1.GetToolBarCtrl().CommandToIndex(ID_COMBO1);
int nIndex = m_wndToolBar1.GetToolBarCtrl().CommandToIndex(ID_SLIDER1);
if (!m_wndToolBar1.CreateSlider(m_wndToolBar1.m_slider1, nIndex, ID_SLIDER1, 100, 100))
{
TRACE0("Failed to create toolbar's slider\n");
return -1;
}
int nIndex1 = m_wndToolBar1.GetToolBarCtrl().CommandToIndex(ID_SLIDER2);
if (!m_wndToolBar1.CreateSlider(m_wndToolBar1.m_slider2, nIndex1, ID_SLIDER2, 100, 100))
{
TRACE0("Failed to create toolbar's slider\n");
return -1;
}
I just added the combobox to my class which had sliders before. But in the resource editor I put the ID_COMBO1 at the very end of all the buttons, and when I debug, nIndex2 is indeed as it should be.
However when I run it, the combobox shows up as a blank white space (sort of like an edit box), and its replaced another button that I had in the toolbar!!!!!!
ANy ideas on how to make this behave?
Appreciate your help,
ns
|
|
|
|
|
Its so bizzare! When I reloacted the segment of code that creates the combobox to after the creation of the sliders, it came up in the right place!!!! Strange since I was positioning it by CommandToIndex.....
Appreciate your help,
ns
|
|
|
|
|
My program is running on a Pocket PC and receives some characters, better say a string (like "grün" - thats the german word for GREEN) from a device.
I save the string in a CString . The problem is that when I display the string on my dialog I will see a wrong character for the 'ü' character of the string.
The asci code of the received character is 0x81, but that's the wrong character on my Pocket PC, the asci code für 'ü' on my Pocket PC should be -4 (= 252 = 0xFC).
How can I convert some characters?
Daniel
---------------------------
Never change a running system!
|
|
|
|
|
the asci code für 'ü' on my Pocket PC should be -4
No, -4 is only equivalent to 252 only if casting to a 8bit unsigned char . I guess your problem is that you're reading characters from the device into a (signed) char variable and converting them into 16bit Unicode characters, which won't get 252 for ü. Try reading into unsigned char s.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hello...
Was wondering if anyone knows how to programmatically set the Visual C++ paths for .NET. In the old days of VC6, you could update the registry settings in "HKEY_CURRENT_USER\Software\Microsoft\DevStudio\6.0\Build System\Components\Platforms\Win32 (x86)\Directories" which worked just fine. However I could not locate this key for VC7, any help would be greatly appreciated.
- Scott
|
|
|
|
|
HKLM\Software\Microsoft\VisualStudio\7.0\Vc\VC_OBJECTS_PLATFORM_INFO\Win32\Directories
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
Hi PJ,
Thanks for the answer, however I have tried that already with no success, sorry I should have mentioned that. It seems that when you insert a path using the registry editor, lets say:
Include Dirs - C:\My Company\My Code\Include;
And open VisualStudio.NET and choose "Tools", "Options", "Projects", "VC++ Directories" and select Include Files, you will not see the path you just added. Additionally, if you add this path from within VisualStudio, you will not see the registry entry update either.
It appears that this registry entry is not really used, or used for another purpose and there is an external file that VS.NET is using to store and read this information from.
Any help in solving this mystery would be greatly appreciated
Cheers, Scott
|
|
|
|
|
Have a look at the file "VCComponents.dat" found in the folder "C:\Documents and settings\<your user name>\Local Settings\Application Data\Microsoft\Visual Studio\7.0\"
I found that by entering a bogus name in one of the directory fields in vs7, and then doing a search for all files containing that bogus name. This was the file that came up.
CPUA 0x5041
Sonork 100.11743 Chicken Little
"So it can now be written in stone as a testament to humanities achievments "PJ did Pi at CP"." Colin Davies
Within you lies the power for good - Use it!
|
|
|
|
|
Thank you, that did the trick!
|
|
|
|
|
hi i am trying to use a hashtable in Visual C++. is there any class in VC++ to create hashtables ?
in some programs i saw that the hashtables is Sizable, for example a hash table with 2 mb Size (i think 2 mb of RAM) is it possible in VC++ to set a size of hashtable ?
thanx a lot
|
|
|
|
|
-=Ehsan-de-Burge=- wrote:
hi i am trying to use a hashtable in Visual C++. is there any class in VC++ to create hashtables ?
MFC CMap etc. uses hash tables. If you don't want to be locked intp VC++/MFC then look at STL, in particular STLPort.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
He'd have to look in pretty much every STL other than the one shipped with VC++/VS.NET. hasmap<> is a proposed container, not a standard one I believe (I think it comes from SGI, maybe as old as HP).
--
Eventhough the forrest is full of trees, there's still no tree between the trees.
|
|
|
|
|
Jörgen Sigvardsson wrote:
He'd have to look in pretty much every STL other than the one shipped with VC++/VS.NET. hasmap<> is a proposed container, not a standard one I believe (I think it comes from SGI, maybe as old as HP).
Yep, maybe one day the VC++ STL implementation will be brought up to date. STLPort http://www.stlport.com[^]seems to be one of the more popular STL's for VC++ developers and does include hashed containers: hash_set, hash_multiset, hash_map, hash_multimap. See the original SGI Documentation at: http://www.sgi.com/tech/stl/table_of_contents.html[^] for details.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
Need some help in porting a Windows C++ program which uses STL to Solaris..I just need to know the Makefile options that I need to set..i am getting tons of errors when I COMPILE the program in solaris. Does anyone have any good links that can help ??
thanks
There are no failures; there are only extended learning opportunities.
|
|
|
|
|
You say you get errors when you run the program... does this mean you have compiled it? If you haven't compiled it, what are the errors like? Also, what compiler are you using?
|
|
|
|
|
thanks for answering..
i am sorry my question is wrongly worded..i meant to say that I get errors when I compile the program..the compiler is not able to find the usual STL headers like string, vector etc etc..
thanks
There are no failures; there are only extended learning opportunities.
|
|
|
|
|
If you're compiling using Sun's Workshop, then all the STL headers should be automatically included for you - theres no compile options needed. There is an option for when compiling templates in library files, but that should be detailed in the man page. If you're compiling with gcc then you may need to add in the STL part - go to STLport, and you can download a full STL implementation. There should be docs there on how to link it in with your program
|
|
|
|
|
i am compiling using Sun's workshop (CC)..
and this is a sample of the error messages that i get..
( i tried with .h extensions too ie list.h,string.h etc etc )
"keymatch.cpp", line 4: Error: Could not open include file list.
"keymatch.cpp", line 5: Error: Could not open include file string.
"keymatch.cpp", line 6: Error: Could not open include file deque.
"keymatch.cpp", line 8: Error: Could not open include file fstream.
There are no failures; there are only extended learning opportunities.
|
|
|
|
|
What version of workshop? Workshop < 5 does not have any STL, in which case you'll need the stlport mentioned above. If you have Workshop 5+ then STL is bundled with this, and your installation must be screwed. I dont have access to a sparc at the moment, but from memory the STL files are located somewhere within the workshop directory (/opt/SUNWspro is likely), and they dont have .h extensions either!
|
|
|
|
|
yes i was using 4.2 and it did not work..I tried the same on a box with 6.0 and yippeeee!!!! it is working like crazy !! thanks a lot anonymous..thanks a ton..
There are no failures; there are only extended learning opportunities.
|
|
|
|
|
Hi,
I'm looking for some help in developing a PIN generation algorithm for scratch cards. What I would like to do is take a range of "control numbers" (a sequential number representing a batch of PINs) and generate a 10-14 digit PIN based on that. I'm not looking for a random number generation, but something that will generate a pseduo-random number based on the control number. To further complicate the issue, the PINs would need to be unique over a large range control numbers (1M+).
I've experimented with different operations like MOD and shifting and I get a nice range of random PINs. But I cannot seem to figure out how to make the number unique over the range I'm looking for. I know it can be done but the math to develop / prove it is beyond me.
And suggestions or references would be appreciated. I understand that something like this is very propriety to a business so I'm not necessary looking for a complete solution, just a point in the right direction.
Below is an example of what I'm trying to do. Thanks in advance for the help,
David
Control # PIN
00000001 123.456.789.123
00000002 638.098.270.748
00000003 472.309.327.732
0000nnnn 852.382.127.034
|
|
|
|
|
you could just encrypt the control # with a cipher of some kind (there are a few here on CP). the output of a cipher is guaranteed to be unique - it has to be, if it can decrypt the encrypted data back to the correct input. personally, i would use a stream cipher (of which i don't see any on CP), since it eliminates the need for input padding. but, a block cipher will work, too.
so:
PIN = Encrypt(Control#)
where the control # has at least as many bits as the PIN.
-c
Zzzzz...
|
|
|
|
|
Interesting solution, I'll definitely take a look into it. Thanks for the quick reply.
D
|
|
|
|