We want to generate dynamic resource file for VC++ where the data will come from database (Oracle).
For an example, When a user log in the system, at that time if User is an English User, then some data in english language needs to be loaded in vc++ resource file. If the user is French then French data will be loaded into the resource file.
Right now all the data are hard-coded in the resource file but we want to load it dynamically from database, based on the login-user language.
How to do this dynamic implementation as I am not able to find any such concept in google.
Found an online suggestion of using an rc2 file and cut and paste stuff from .rc file to .rc2 file to see which line causes the problem but don't know how to create a blank .rc2 file. Problem started after I ported from VC++ 6 to VS2010.
I have an SDI / CView app (VS 2010). All works well until I minimize the app using the minimize button or drag it partially off of the screen. In the former instance, any attempt to restore the app results in an appcrash with a tight freeze up of the machine. In the later instance the same happens immediately.
In building the app, I scoured the web for code to accomplish the loading and display of the bitmap. After some experimentation I settled on overriding the OnPaint. Below is the code. Note that m_Map is a CBitmap member and IDB_BITMAP1 is a loaded bitmap resource.
Code:
void CMyDragViewView::OnPaint() { // CPaintDC dc(this); // device context for painting // TODO: Add your message handler code here // Do not call CView::OnPaint() for painting messages // http://msgroups.net/microsoft.public.vc.mfc/loading-bitmaps-into-main-window/563285 int x = m_Map.LoadBitmap(IDB_BITMAP1); TRACE1(" x = %d ", x); CPaintDC* dc = new CPaintDC(this);
[code]....
I suspect that the problem is OnPaint trying to repaint the bitmap which requires reloading it, but I don't know how to work around this.
I'm working on a project which consists of several ocx loaded by one exe. The platform is WinCE. Now I'm on a process to create a new ocx. I do have a copy of those ocx projects in Win32 platform. These Win32 versions were only used to register ocx in local system and then put those on to application dialog by 'Insert ActiveX'.
Now the problem is those Win32 projects are so outdated, and unable to build. Getting too many linking errors to be solved.
I have build the new ocx and link that with exe manually by editing .rc file and all. But still no luck. New ocx is getting registered in WinCE device but failing to start application.
I used onctlcolor() method to set the background color for the controls & Dialog. I run my application, working good but after 15 mins the below error occured,
Application Error:
The Required Resource Was --------> Shown message box
Program Error:
First-chance exception at 0x7c81eb33 in XRay.exe: Microsoft C++ exception: CResourceException @ 0x001274f8. First-chance exception at 0x7c81eb33 in XRay.exe: Microsoft C++ exception: CResourceException @ 0x001259d0. First-chance exception at 0x7c81eb33 in XRay.exe: Microsoft C++ exception: CResourceException @ 0x00123ea8. First-chance exception at 0x7c81eb33 in XRay.exe: Microsoft C++ exception: CResourceException @ 0x00122380. First-chance exception at 0x7c81eb33 in XRay.exe: Microsoft C++ exception: CResourceException @ 0x00120858. Warning: Uncaught exception in WindowProc (returning 0).
what is the reason for that? How can i prevent my project from this problem.
The problem is that I do not want to have an external MapData.txt, rather I access it through a embedded text resource, which in this case I have no knowledge on doing so.
I have the following snippet which demonstrates to my knowledge on how to access a text resource; however, I do not know hot to modify the code above to implant this, but to still have the same functionality as the original code above.
I have a .png file that my console app reads and puts into a structure that is saved as a file. The png is always the same so I thought I could just add it as a resource image to a resource file so it would be included in my program and not as a separate file. When I did that, the png shows up as a "SystemDrawingBitmap". If I examine this resource in a watch I see "Base" and "Static" members. Expanding those properties does not give me anything useful such as a pointer to the raw png data and its length in bytes.
If worse comes to worse, I can always make a hex dump of the png contents and then put the hex code into a CS file using static initialization.
Surely there is some way I can access the raw data internally and read the bytes into a byte array using C#
Write a function named generateLotteryNumbers. The function is passed an int array of size 5. The function should generate 5 different lottery numbers in the range 1 to 50 inclusive and place the numbers in the array. The declaration is as follows:
Note that no data is passed in to the function. The array is used to return the function results. Thus the parameter is an OUT parameter. Do not display the result. Return the result.
Do not seed the random number generator inside the function. If you seed the random number generator inside the function and the function is called many times in the same second, your function will return the same results each time it is called.
I know how to generate the numbers in the specified range but I do not know how to test for duplicates. Here is the code I have so far:
Code: //This program will test the "generateLotteryNumbers" function #include <iostream> #include <cstdlib> #include <ctime> using namespace std; void generateLotteryNumbers (int lotteryNumbers[]);
[Code] ....
When I try to compile this, my compiler tells me that lines 41 and 46 require an array or pointer type.
The scenario is that I have an XSD schema; I have generated a C# class using the XSD tool in the Visual studio command line.
I have then created a basic console app, which will populate the first partial class in the generated C# class.
The program will then serialize this data and create an XML in a folder as a proof of concept.
The issue I'm having is working out the best way to populate and serialize all the data from the class, as the XSD it was generated from is quite large.
I would like to be able to randomise the data at a later stage once I have the basic populating and serializing working.
How can i change or add a cell to an array without knowing its length ? (I mean that I shouldn't know the length I need to make the length dynamic so i can add a cell)we just learned Dynamic assignment(I hope this is the correct name) and Pointers.
We're designing a new software and we want it to be customizable without code. That, for us, mean we can change the software behaviour without re-writing code. All will be developed using C and .NET.
One of our goals is to have what we are calling "dynamic tables". This means that these database tables may have different fields depending on the customization. We got to know it using high-level ERPs like SAP or CRM's system like VTIGER or even SalesForce. Let me give an example:
CUSTOMER TABLE:
FIELDS: ID, NAME, ADDRESS, PHONE.
This would be the standard Customer Table.
Now, a new customer needs to add FINANCE SCORE and RANKING to the database. We them would like to go to our application (not the database itself) and adding these new fields. After that, all of my input forms and reports would start to show and process these new fields.
I've created a dialog based MFC app which input from user to create that many dynamic controls(Used checkbox to be created dynamically).
After user input that many checkboxes controls are created but if try to click again then not able to delete previous controls and again new no. of controls.
Code snippet to add controls on user input.
RECT rctA; rctA.top = 51; rctA.bottom = 80; CString temp; m_Edit.GetWindowText(temp); int noOfControls = _tstoi(temp);
The goal is to change the status bar (CMFCRibbonStatusBar) icons based on some events. (The old CMFCStatusBar class had the SetPaneIcon() member that easily solves the problem.)
The "improved" CMFCRibbonStatusBarPane has no members to set the icon, other then the constructor. Being a subclass of CMFCRibbonButton, it has SetImageIndex() that sets the icon index in the image list. The MS online support does not mention how and where to set that "list of images". My understanding is that the list belongs to the Button's parent; in this case it is the CMFCRibbonStatusBar, which has no methods to set any image list. How and where am I supposed to set that list of images for the status bar?
Second related question: I have tried to set the pane icon with the CMFCRibbonStatusBarPane() constructor by loading it from an icon resource. The icon appears shortly and then it is replaced by a gray patch. (for tests I also used one of the icons given by the MFC wizard, with the same result)
The code is:
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { .......... if (!m_wndStatusBar.Create(this)) { TRACE0("Failed to create status bar ");
[Code] ....
This code was placed within a program created by the MFC wizard that does nothing else. I absolutely do not "touch" the status bar after it is created here in CMainFrame::OnCreate().
Apparently the icon is "erased" after OnCreate() exits. Where, how? I have made HICON icon; a member of my CMainFrame class, with the same result.
I have a data file called "data.txt" which contains an unknown amount of random numbers. I was successfully able to open that file read from it all the numbers and cout the total amount of numbers and all the numbers inside the file. I have to now convert those numbers from file into an array dynamically.
#include <iostream> #include <fstream> #include <string> using namespace std; int main() { ifstream fin; int n=0;
[Code] ...
I'm sure that staring from the part where I start to create a dynamic array everything following that is wrong.
I'm writing a program in which I have to use a matrix to represent a file in code. because it's a file, the size of the matrix is undefined, and therefore the matrix has to be dynamic. I found out that my compiler doesn't like dynamic multidimensional arrays, so I was thinking of this matrix as a dynamic (monodimensional) array of other dynamic (monodimensional) arrays. My program (and thus this example) uses unsigned chars.
i'm implementing a playerclass for a game.. in the game there are multiple player types, weapons ect.. i just wanted to turn my players weapons into a dynamically allocated c_str. once i added my: Destructor, Copy Constructor and Overloaded Assignment Operator. My initial values became corrupted and i cannot fix them.
/part of main function int *A=NULL; //load from file load_from_file(A, &next); printf("next=%d ",next); getchar(); printf("A[%d]=%d ",0,A[0]);getchar();//here program crashes }
[code]....
I initialize array A with NULL in main, and I "load" it with elements from a file. The code without function is working. But when I tried to use a function as above, my array crashes!!!
I have done a test, I have edited with the WordPad in Windows on my Local Webserver a file banana.h which contains a list of float arrays in order to extract one array and create a text file named ObjVerts.txt I have done a lot of search in the Web in order to find a small piece of code that can read the text file and convert it to a float array GLfloat, but I did not find any. I have found a lot of piece of code that read the file and make a NSData but many of the code seem to not work. It seem that the last statement return nothing!
I am working on an OOP assignment (text handler) which part of its description is:
Some lines of text as a story which the delimiter between each story is %%%%%
Each text loaded should only occupy the space needed for the text to fit.
It's required to use dynamic variables of type char*. To be more detailed, the text-handler must contain a vector of such char-pointers (i.e. c-strings), and the parameter in the constructor indicates how many pointers (c-strings) to be contained in the vector. Each loaded text will be represented by a number, so that the first text in the file gets number 0 and the next one gets number 1 ... etc. When you want to access a text, you request the text with a certain number, and then get a pointer in return that may be used to output the text on the screen.
My problem is first to allocate a dynamic memory like char** without defining the number of array elements (Each text loaded should only occupy the space needed for the text to fit. )and then store each story from text file (comprise of a few lines of text) into that dynamically located memory(char **)to be able to do some operation on it later.
I have a program that generates random numbers. After the random number is generated, the program asks if you want to generate another random number. However, if you generate another random number, it is always the same as the first random number. How can I fix this?
I want to generate big random numbers in C(not C++ please).By "big" I mean integers much bigger than srand(time(NULL)) and rand() functions' limit(32767).
I tried writing: (note:I am not able to see "code" tag button in this editor,so I am not using it)
But I have doubts about it's randomness quality.Also there is another problem,the program can't know the maximum random number it should use before user input,so maximum random number may need to use much smaller maximum random number according to user input.
Is there a better algorithm to create big random numbers in C?
I'm creating a game in C++ and need to generate random numbers. I know about
int main() { srand(time(NULL)); //Initialises randomiser or sum' like that int x=rand%10; //Generates from 0-9 cout<<x; }
Now, I need the best way to generate random numbers. Do I call "srand(time(NULL));" every time I want to randomise? What is the best method to generate a nearly perfect random number?
I may need to call a randomiser more than once a second, so taking second as seed (I believe that's what srand(time(NULL)); does).
But I have doubts about it's randomness quality.Also there is another problem,the program can't know the maximum random number it should use before user input,so maximum random number may need to use much smaller maximum random number according to user input.
Is there a better algorithm to create quality big random numbers in C?