|
friends
i created a Member object of Dialog class and
use the memberobject.Create(resourceID,parentWindow);
to create that ..
It work as fine in the DEBUG
but not in release ..Any idea????
Hai Friends me from Pandalam..and i think there is a sofware behind everything...
so enjoy with the codes...
|
|
|
|
|
Check the optimizations in the project options .
|
|
|
|
|
everything is ok on that part...
i think there is some memory issues...
Hai Friends me from Pandalam..and i think there is a sofware behind everything...
so enjoy with the codes...
|
|
|
|
|
What about creating a new Forum for Managed C++?
Al
|
|
|
|
|
Albert Pascual wrote:
What about creating a new Forum for Managed C++?
I'm still using VC++ 6 and haven't gotten a chance to check out the new .NET development environment. What're the differences between VC++ 6 and Managed C++? Is it a new derivative of the language, or just a new IDE?
-Mike Zinni
Software Engineer
email: mzinni@rimail.com
AIM: zin9999
|
|
|
|
|
This question best answered by somebody at Microsoft like Nick Hodapp.
But in my modest opinion MC++ is like C# but better as you can add managed and unmanaged code (without P/Invoke)
It's more than C++ with a gargabe collection, has the same classes than C# and as flexible as C++
Cheers
Al;P
|
|
|
|
|
Why not just post your questions here for now? There haven't been too many MC++ questions in the past. If enough people do so, it might make sense for Chris to create a new forum.
--------
And we die young.
Faster we run. Alice in Chains, We Die Young
|
|
|
|
|
I thought that if we had a C# forum we should also have one for MC++.
Al
|
|
|
|
|
Albert Pascual wrote:
I thought that if we had a C# forum we should also have one for MC++.
There is no VB.NET forum though.
[dodges flaming arrows]
--------
And we die young.
Faster we run. Alice in Chains, We Die Young
|
|
|
|
|
I agree. MC++ and C-hash has nothing to do with C++ (even that this forum is really Visual C++ which isn't C++ by a longshot).
|
|
|
|
|
Hi,
I'm trying to create dsn's programatically for an installation I'm doing. When I create them either by setting the registry setting (ID: Q184608) or calling the following:
<br />
#include "stdafx.h"<br />
<br />
#include "stdio.h"<br />
#include "windows.h"<br />
#include "sql.h"<br />
#include "odbcinst.h"<br />
<br />
<br />
int main(int argc, char* argv[])<br />
{<br />
RETCODE retcode;<br />
<br />
retcode = SQLConfigDataSource(NULL,<br />
ODBC_ADD_DSN,<br />
"SQL Server",<br />
"DSN=MY_TEST\0"<br />
"LastUser=test_user\0"<br />
"Database=test_database\0"<br />
"Driver=C:\\WINNT\\System32\\sqlsrv32.dll\0"<br />
"Server=test_server\0\0");<br />
<br />
return 0;<br />
}<br />
The DSN doesn't show up in the ODBC Data Source Administrator. I even exported the settings from the registry to make sure everything was being set correctly.
Can anyone point me in the right direction as to why they don't show up?
Thanks in advance,
Craig
|
|
|
|
|
Hi Guys I an trying to read in a binary file to a variable called buffer.
See code below
buffer is defined as char *
but when I debug code, buffer only seems to hold the first character from the file.
What I am trying to achieve is to read in the file search it for a particular string and when I find
this string, read in the entry in the file which is x characters after the first found string
I know 'seekg' can read in characters from a given position.... but firstly I have to find the position
of a particular string in the file.
The file is an SQL Server Profiler trace file.
Is there some other way I can do this - Is there any way I can serach the file without reading it in...
or do I need to declare buffer in a different way.
Any ideas would be appreciated
Cheers
=====================================================
// readbinaryfile.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream.h>
#include <fstream.h>
#include <string.h>
const char * filename = "C:\TenforeFeed.trc";
char * buffer;
long size;
char * pch;
int main(int argc, char* argv[])
{
ifstream file (filename, ios::in|ios::binary|ios::ate);
if(file.is_open())
{
size = file.tellg();
file.seekg (0, ios::beg);
buffer = new char [size];
file.read (buffer, size);
cout << buffer[3];
//delete[] buffer;
}
return 0;
}
========================================================
|
|
|
|
|
I'm assuming, the value returned by tellg is the correct value. If so, try it with a file you construct using Notepad. If the file contains UNICODE data, typically, every other byte is 0. This causes the string to look like it is only one character long.
Hope this helps,
Bill
|
|
|
|
|
Use wchar_t instead of char
|
|
|
|
|
Hi guys,
All the code that I have ever written has been for the standard english version of windows. Recently, though, my company has been talking about sending our software overseas to some of our partners. The people that will be using it will speak english so I won't have to get menus, titlebars and things like that translated. BUT I know that they will connecting to databases that use different character sets. (I don't have access to a nonenglish version of Windows or SQL server yet.) Can you guys give me some tips on using Unicode or anything that I should look out for.
I guess I'm wondering about things like when to use TCHAR, _T() and if CString holds up inplace or do I have to rewrite things. Any tips or things to watch out for would be greatly appreciated.
Here is some code that I'm thinking of using it would connect to a db and bring back a list of tables from a combobox selected database will it work for double byte unicode?
----------------------------------------------------
//Get the User selected db from the combobox
CString db = _T("");
m_cmbDatabases.GetLBText(m_cmbDatabases.GetCurSel(),db);
//Open a new conncetion to the User selected db
//m_Server,m_LoginName,m_Password are CStrings returned from a dlg
CString strConnection = _T("");
strConnection.Format("driver={SQL Server};server=%s;uid=%s;pwd=%s;database=%s",m_Server,m_LoginName,m_Password,db);
if(DB.Open(strConnection))
{
//Update m_lstTables
CString Tablename = _T("");
RS = CERecordset(&DB);
if(RS.Open("SELECT name FROM sysobjects WHERE type = 'U' order by name"))
{
m_lstTables.ResetContent();
while(!RS.EOF())
{
RS.GetField("name",Tablename);
m_lstTables.AddString(Tablename);
----------------------------------------------------
|
|
|
|
|
You should use _T() for any literal strings in your source.
So, the Format() call should be:
strConnection.Format(_T("driver={SQL Server};server=%s;uid=%s;pwd=%s;database=%s"),m_Server,m_LoginName,m_Password,db);
and any other call that uses literal strings should also have the _T().
I haven't used CERecordSet, so I don't know if it is Unicode aware. Is the Open() call specified to take an LPCTSTR (or a CString)? Does the GetField() member take an LPCTSTR (or a CString)?
You should look at the MSDN documentation for "Strings: Unicode and Multibyte Character Set (MBCS) Support". They do a pretty good job describing what to look for when using Unicode.
Best regards,
John
|
|
|
|
|
i have been using CToolBar but it only allows 16 colors (as far as I can tell).. so i tried switching to CToolBarCtrl.. but I never get any toolbar to appear.. can someone tell me what in my code is causing the toolbar to not show up, also does the AddButtons() command only take one TBBUTTON at a time?
I've been looking through msdn and on CP today, but can't find a basic example of thie CToolBarCtrl that works, as most of them call a command GetToolBarCtrl() which isn't a member of CToolBarCtrl, but rather CToolBar.. any help would be much appreciated!
i just want the toolbar to show up, from there i can add all my other button code:
m_wndToolBar.CreateEx(WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_FLYBY | CBRS_SIZE_DYNAMIC, WS_CHILD, CRect(CPoint(0,0),CPoint(500,510)), this, IDR_MAINFRAME);
m_wndToolBar.AddBitmap(17, IDB_SCTOOLBAR);
TBBUTTON btn;
btn.fsStyle = TBSTYLE_BUTTON;
btn.fsState = TBSTATE_ENABLED;
btn.idCommand = ID_FILE_NEW;
btn.iBitmap = 1;
m_wndToolBar.AddButtons(1, &btn);
also, what is the point of the CRect getting passed in the CreateEx? I have no idea what size CRect to pass here..
thanks!
-dz
|
|
|
|
|
If all you want is more than 16 colors, that is easily possible with the normal MFC toolbar support. Here is the process:
- Create the toolbar normally in the resource editor
- Edit the toolbar bitmap manually, converting it to high color
- The bitmap will be converted to 16 colors by MFC when it is loaded, so you will use the following code (nResourceId is the toolbar resource identifier, and m_toolbar is the CToolBar object):
HBITMAP hBmp = static_cast<HBITMAP>(LoadImage(AfxGetResourceHandle(),
MAKEINTRESOURCE(nResourceId), IMAGE_BITMAP,
0, 0, LR_SHARED | LR_LOADMAP3DCOLORS));
m_toolbar.LoadToolBar(nResourceId);
m_toolbar.SetBitmap(hBmp);
--------
And we die young.
Faster we run. Alice in Chains, We Die Young
|
|
|
|
|
thank you so much! this worked great!
-dz
|
|
|
|
|
I have created the control derivative from CEdit .
Inside him, from the right side, it is necessary for me to arrange CScrollBar .
I have two questions:
1. How correctly to choose ID for him?
2. Where correctly to create CScrollBar (standard scrolling does not approach, because it is necessary for me to create CScrollBar smaller length than height of the control)?
Excuse, if my questions will seem children's
Best regards,
Eugene Pustovoyt
Eugene Pustovoyt
Sonork ID 100.10002:Yaumen
|
|
|
|
|
1. Any non 0 value should be OK. You will be creating the scrollbar as a child of the edit control, so it will not be clashing with anything else unless your CEdit derived class has a lot of child windows.
2. You can create the scroll bar in the OnCreate of your CEdit controls derived class. Call the base class first then create the scroll bar. You will also need to override the OnSize() to correctly possition the scrollbar in the CEdit's client area. Don't forget to check that the window is valid before calling MoveWindow on it.
Roger Allen
Sonork 100.10016
yet to be identified being from the planet Paltinmoriumbanfrettybooter
|
|
|
|
|
I tried to use OnCreate , but at use SubclassDlgItem() I do not get in OnCreate .
Therefore I have decided to create scroll bar in a PreSubclassWindow () method.
But there is one problem!!! I do not know exact height and a position scrollbar yet I shall not start draws the control in OnPaint. How to be in this case?
Best regards,
Eugene Pustovoyt
Sonork ID 100.10002:Yaumen
|
|
|
|
|
Ahh, that makes it more clear. Because you are sub-classing the item, this happens in a dialog OnInitDialog function. I would write a public function as part of the class to create the scrollbar. Something like this:
bool CMyEdit::CreateScrollBar()
{
CRect rect ;
GetClientRect(&rect) ;
if (!m_ScrollBar.Create(WS_CHILD | WS_VISIBLE | SBS_HORZ, rect, this, 1))
{
TRACE("Failed to create scroll bar\n") ;
return false ;
}
return true ;
}
You would then call this in the OnINitDialog after the control has been sub-classed.
Roger Allen
Sonork 100.10016
yet to be identified being from the planet Paltinmoriumbanfrettybooter
|
|
|
|
|
Thank for the help!!!
Now I create CScrollBar<code> in <code>PreSubclassWindow()
pVScroll.Create(WS_CHILD | WS_VISIBLE | SBS_VERT | SBS_RIGHTALIGN, CRect (0, 0, 100, 100), this, 100);
And then in function OnPaint() when becomes the sizes scrollbar are known, I do the following
pVScroll.MoveWindow(rect);
As far as I do correctly all?
Best regards,
Eugene Pustovoyt
Sonork ID 100.10002:Yaumen
|
|
|
|
|
It's better to move (resize) the scrollbar when your edit control gets a WM_SIZE , not WM_PAINT . A WM_PAINT handler should be as fast as possible.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|